From: Steve Clevenger <scclevenger@os.amperecomputing.com>
To: james.clark@arm.com, mike.leach@linaro.org
Cc: suzuki.poulose@arm.com, leo.yan@linaro.org,
ilkka@os.ampercomputing.com, coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
"steve.c.clevenger.ampere" <scclevenger@os.amperecomputing.com>
Subject: [PATCH 4/5] Add map pgoff to python dictionary based on MAPPING_TYPE
Date: Tue, 20 Aug 2024 16:11:32 -0600 [thread overview]
Message-ID: <a813c21ee60cd03df02b33bfa92515b659863bf7.1724104248.git.scclevenger@os.amperecomputing.com> (raw)
In-Reply-To: <cover.1724104248.git.scclevenger@os.amperecomputing.com>
From: "steve.c.clevenger.ampere" <scclevenger@os.amperecomputing.com>
Add map_pgoff parameter to python dictionary so it can be seen by the
python script, arm-cs-trace-disasm.py. map_pgoff is forced to zero in
the dictionary if file type is MAPPING_TYPE__IDENTITY. Otherwise, the
map_pgoff value is directly added to the dictionary.
Signed-off-by: steve.c.clevenger.ampere <scclevenger@os.amperecomputing.com>
---
.../util/scripting-engines/trace-event-python.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index fb00f3ad6815..8a056c3574ec 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -798,7 +798,8 @@ static int set_regs_in_dict(PyObject *dict,
static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
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)
+ const char *sym_field, const char *symoff_field,
+ const char *map_pgoff)
{
char sbuild_id[SBUILD_ID_SIZE];
@@ -814,6 +815,12 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
PyLong_FromUnsignedLong(map__start(al->map)));
pydict_set_item_string_decref(dict, dso_map_end,
PyLong_FromUnsignedLong(map__end(al->map)));
+ if (al->map->mapping_type == MAPPING_TYPE__DSO)
+ pydict_set_item_string_decref(dict, map_pgoff,
+ PyLong_FromUnsignedLongLong(al->map->pgoff));
+ else
+ pydict_set_item_string_decref(dict, map_pgoff,
+ PyLong_FromUnsignedLongLong(0));
}
if (al->sym) {
pydict_set_item_string_decref(dict, sym_field,
@@ -898,7 +905,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
pydict_set_item_string_decref(dict, "comm",
_PyUnicode_FromString(thread__comm_str(al->thread)));
set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end",
- "symbol", "symoff");
+ "symbol", "symoff", "map_pgoff")
pydict_set_item_string_decref(dict, "callchain", callchain);
@@ -923,7 +930,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
PyBool_FromLong(1));
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");
+ "addr_symbol", "addr_symoff", "map_pgoff");
}
if (sample->flags)
--
2.25.1
next prev parent reply other threads:[~2024-08-20 22:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 22:11 [PATCH 0/5] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset Steve Clevenger
2024-08-20 22:11 ` [PATCH 5/5] Adjust objdump start/end range per map pgoff parameter Steve Clevenger
2024-08-20 22:11 ` Steve Clevenger [this message]
2024-08-20 22:11 ` [PATCH 3/5] Force MAPPING_TYPE__IDENTIY for PIE Steve Clevenger
2024-08-20 22:11 ` [PATCH 2/5] Add dso__is_pie prototype Steve Clevenger
2024-08-20 22:11 ` [PATCH 1/5] Add dso__is_pie call to identify ELF PIE Steve Clevenger
2024-08-26 13:13 ` Leo Yan
2024-08-26 21:33 ` Steve Clevenger
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=a813c21ee60cd03df02b33bfa92515b659863bf7.1724104248.git.scclevenger@os.amperecomputing.com \
--to=scclevenger@os.amperecomputing.com \
--cc=coresight@lists.linaro.org \
--cc=ilkka@os.ampercomputing.com \
--cc=james.clark@arm.com \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=suzuki.poulose@arm.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
all inboxes | Powered by JetHome®