* [PATCH] perf disasm powerpc: handle Power10 prefixed instruction continuation lines
@ 2026-09-07 5:14 Athira Rajeev
0 siblings, 0 replies; only message in thread
From: Athira Rajeev @ 2026-09-07 5:14 UTC (permalink / raw)
To: acme, jolsa, adrian.hunter, maddy, irogers, namhyung
Cc: linux-perf-users, linuxppc-dev, atrajeev, hbathini, tejas05,
tshah, venkat88, narnalli, vpuliyal
Power10 introduces prefixed instructions that are 8 bytes wide. objdump
emits these as two lines: the first carries both the raw bytes and the
mnemonic, while the second carries only the raw bytes of the second word
with no mnemonic:
1020900c: 0b 00 10 06 pla r31,757280 # 102c1e2c <cctki_vi_ML_CCZ4>
10209010: 20 8e e0 3b
disasm_line__parse_powerpc() calls disasm_line__parse() on the mnemonic
portion of the line. disasm_line__parse() returns -1 when the name
string is empty, which causes disasm_line__new() to return NULL, which
causes symbol__parse_objdump_line() to return -1, which immediately
breaks the objdump output parsing loop in symbol__disassemble_objdump().
The result is that annotation of any function containing a prefixed
instruction stops at the continuation word and all subsequent
instructions in the function are lost.
Fix this by treating an empty mnemonic as a valid case in
disasm_line__parse_powerpc(): skip the call to disasm_line__parse() and
set the instruction name to an empty heap-allocated string instead,
allowing parsing to continue to the next line.
Reported-by: Narendra Nalli <narnalli@in.ibm.com>
Reported-by: Vijay Puliyala <vpuliyal@in.ibm.com>
Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
---
tools/perf/util/disasm.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
index e263a2a8715d..8dca703a5c74 100644
--- a/tools/perf/util/disasm.c
+++ b/tools/perf/util/disasm.c
@@ -884,10 +884,24 @@ static int disasm_line__parse_powerpc(struct disasm_line *dl, struct annotate_ar
if (name_raw_insn[0] == '\0')
return -1;
- if (disasm)
- ret = disasm_line__parse(name, namep, rawp);
- else
+ if (disasm) {
+ /*
+ * Power10 prefixed instructions are 8 bytes and objdump emits
+ * the second word on its own line with raw bytes but no
+ * mnemonic, e.g.:
+ * 1020900c: 0b 00 10 06 pla r31,757280
+ * 10209010: 20 8e e0 3b
+ *
+ * Treat a missing mnemonic as an empty instruction name rather
+ * than a parse failure, so that parsing continues past it.
+ */
+ if (name[0] != '\0')
+ ret = disasm_line__parse(name, namep, rawp);
+ else
+ *namep = strdup("");
+ } else {
*namep = "";
+ }
tmp_raw_insn = strndup(name_raw_insn, 11);
if (tmp_raw_insn == NULL)
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-07 5:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-07 5:14 [PATCH] perf disasm powerpc: handle Power10 prefixed instruction continuation lines Athira Rajeev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox