Skip to contentSkip to conversation

perf annotate: Allow whitespace between insn operands

PATCH In review Namhyung Kim 2 participants 2 messages Jun 12, 2023 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf annotate: Allow whitespace between insn operands

The llvm-objdump adds a space between the operands while GNU objdump does not. Allow a space to handle the both.

In GNU objdump:

Disassembly of section .text: here

                                                                      |
  ffffffff81000000 <_stext>:                                          v
  ffffffff81000000:	48 8d 25 51 1f 40 01 	lea    0x1401f51(%rip),%rsp
  ffffffff81000007:	e8 d4 00 00 00       	call   ffffffff810000e0 <verify_cpu>
  ffffffff8100000c:	48 8d 3d ed ff ff ff 	lea    -0x13(%rip),%rdi

In llvm-objdump:

Disassembly of section .text: here

                                                                       |

ffffffff81000000 <startup_64>: v
ffffffff81000000: 48 8d 25 51 1f 40 01 leaq 20979537(%rip), %rsp
ffffffff81000007: e8 d4 00 00 00 callq 0xffffffff810000e0 <verify_cpu>
ffffffff8100000c: 48 8d 3d ed ff ff ff leaq -19(%rip), %rdi

---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
index 9171102dd3ad..3eab6c29eaa5 100644
@@ -585,7 +585,7 @@ static int mov__parse(struct arch *arch, struct ins_operands *ops, struct map_sy
 	if (ops->source.raw == NULL)
 		return -1;
 
-	target = ++s;
+	target = skip_spaces(++s);
 	comment = strchr(s, arch->objdump.comment_char);
 
 	if (comment != NULL)
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Namhyung Kim

The llvm-objdump adds a space between the operands while GNU objdump does not. Allow a space to handle the both.

In GNU objdump:

Disassembly of section .text: here

                                                                      |
  ffffffff81000000 <_stext>:                                          v
  ffffffff81000000:     48 8d 25 51 1f 40 01    lea    0x1401f51(%rip),%rsp
  ffffffff81000007:     e8 d4 00 00 00          call   ffffffff810000e0 <verify_cpu>
  ffffffff8100000c:     48 8d 3d ed ff ff ff    lea    -0x13(%rip),%rdi

In llvm-objdump:

Quoted 8 lines

Disassembly of section .text: here

                                                                       |
  ffffffff81000000 <startup_64>:                                       v
  ffffffff81000000: 48 8d 25 51 1f 40 01        leaq    20979537(%rip), %rsp
  ffffffff81000007: e8 d4 00 00 00              callq   0xffffffff810000e0 <verify_cpu>
  ffffffff8100000c: 48 8d 3d ed ff ff ff        leaq    -19(%rip), %rdi

Thanks,
Ian

Quoted 20 lines
---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -2
index 9171102dd3ad..3eab6c29eaa5 100644
@@ -585,7 +585,7 @@ static int mov__parse(struct arch *arch, struct ins_operands *ops, struct map_sy
        if (ops->source.raw == NULL)
                return -1;
 
-       target = ++s;
+       target = skip_spaces(++s);
        comment = strchr(s, arch->objdump.comment_char);
 
        if (comment != NULL)
--

2.41.0.162.gfafddb0af9-goog