From: Adrian Hunter <adrian.hunter@intel.com>
To: Leo Yan <leo.yan@linaro.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
James Clark <james.clark@arm.com>,
German Gomez <german.gomez@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
Eelco Chaudron <echaudro@redhat.com>,
Stephen Brennan <stephen.s.brennan@oracle.com>,
Tanmay Jagdale <tanmay@marvell.com>,
"zengshun . wu" <zengshun.wu@outlook.com>,
Al Grant <al.grant@arm.com>,
coresight@lists.linaro.org, linux-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v5 1/2] perf scripting python: Expose dso and map information
Date: Mon, 16 May 2022 09:51:49 +0300 [thread overview]
Message-ID: <afa9a665-5f6f-5ac8-f4a7-cdf2df5c20ae@intel.com> (raw)
In-Reply-To: <20220515071838.3077178-2-leo.yan@linaro.org>
On 15/05/22 10:18, Leo Yan wrote:
> 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@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> .../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)
next prev parent reply other threads:[~2022-05-16 6:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-15 7:18 [PATCH v5 0/2] perf script python: Add script for CoreSight disassembly Leo Yan
2022-05-15 7:18 ` [PATCH v5 1/2] perf scripting python: Expose dso and map information Leo Yan
2022-05-16 6:51 ` Adrian Hunter [this message]
2022-05-15 7:18 ` [PATCH v5 2/2] perf scripts python: Support Arm CoreSight trace data disassembly Leo Yan
2022-05-15 21:18 ` Ian Rogers
2022-05-16 1:21 ` Leo Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=afa9a665-5f6f-5ac8-f4a7-cdf2df5c20ae@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=al.grant@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=echaudro@redhat.com \
--cc=german.gomez@arm.com \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=stephen.s.brennan@oracle.com \
--cc=tanmay@marvell.com \
--cc=zengshun.wu@outlook.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).