[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yo+gIQgElkOg/3EN@kernel.org>
Date: Thu, 26 May 2022 12:43:29 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Leo Yan <leo.yan@...aro.org>
Cc: James Clark <james.clark@....com>,
German Gomez <german.gomez@....com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Ian Rogers <irogers@...gle.com>,
Eelco Chaudron <echaudro@...hat.com>,
Stephen Brennan <stephen.s.brennan@...cle.com>,
Tanmay Jagdale <tanmay@...vell.com>,
"zengshun . wu" <zengshun.wu@...look.com>,
Al Grant <al.grant@....com>, coresight@...ts.linaro.org,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v6 1/2] perf scripting python: Expose dso and map
information
Em Sat, May 21, 2022 at 09:04:45PM +0800, Leo Yan escreveu:
> This change adds dso build_id and corresponding map's start and end
> address. The info of dso build_id can be used to find dso file path,
> and we can validate if a branch address falls into the range of map's
> start and end addresses.
>
> In addition, the map's start address can be used as an offset for
> disassembly.
>
> Signed-off-by: Leo Yan <leo.yan@...aro.org>
> Acked-by: Adrian Hunter <adrian.hunter@...el.com>
Thanks, applied both patches.
- Arnaldo
> ---
> .../scripting-engines/trace-event-python.c | 21 +++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
> index 659eb4e4b34b..adba01b7d9dd 100644
> --- a/tools/perf/util/scripting-engines/trace-event-python.c
> +++ b/tools/perf/util/scripting-engines/trace-event-python.c
> @@ -755,12 +755,22 @@ static void set_regs_in_dict(PyObject *dict,
> }
>
> static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
> - const char *dso_field, const char *sym_field,
> - const char *symoff_field)
> + const char *dso_field, const char *dso_bid_field,
> + const char *dso_map_start, const char *dso_map_end,
> + const char *sym_field, const char *symoff_field)
> {
> + char sbuild_id[SBUILD_ID_SIZE];
> +
> if (al->map) {
> pydict_set_item_string_decref(dict, dso_field,
> _PyUnicode_FromString(al->map->dso->name));
> + build_id__sprintf(&al->map->dso->bid, sbuild_id);
> + pydict_set_item_string_decref(dict, dso_bid_field,
> + _PyUnicode_FromString(sbuild_id));
> + pydict_set_item_string_decref(dict, dso_map_start,
> + PyLong_FromUnsignedLong(al->map->start));
> + pydict_set_item_string_decref(dict, dso_map_end,
> + PyLong_FromUnsignedLong(al->map->end));
> }
> if (al->sym) {
> pydict_set_item_string_decref(dict, sym_field,
> @@ -840,7 +850,8 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
> (const char *)sample->raw_data, sample->raw_size));
> pydict_set_item_string_decref(dict, "comm",
> _PyUnicode_FromString(thread__comm_str(al->thread)));
> - set_sym_in_dict(dict, al, "dso", "symbol", "symoff");
> + set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end",
> + "symbol", "symoff");
>
> pydict_set_item_string_decref(dict, "callchain", callchain);
>
> @@ -856,7 +867,9 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
> if (addr_al) {
> pydict_set_item_string_decref(dict_sample, "addr_correlates_sym",
> PyBool_FromLong(1));
> - set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_symbol", "addr_symoff");
> + set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid",
> + "addr_dso_map_start", "addr_dso_map_end",
> + "addr_symbol", "addr_symoff");
> }
>
> if (sample->flags)
> --
> 2.25.1
--
- Arnaldo
Powered by blists - more mailing lists