mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf annotate: Allow whitespace between insn operands
@ 2023-06-12 23:00 Namhyung Kim
  2023-06-12 23:55 ` Ian Rogers
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2023-06-12 23:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ian Rogers, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users, Masami Hiramatsu

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

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 9171102dd3ad..3eab6c29eaa5 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf annotate: Allow whitespace between insn operands
  2023-06-12 23:00 [PATCH] perf annotate: Allow whitespace between insn operands Namhyung Kim
@ 2023-06-12 23:55 ` Ian Rogers
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2023-06-12 23:55 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Adrian Hunter,
	Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users,
	Masami Hiramatsu

On Mon, Jun 12, 2023 at 4:00 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> 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
>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/annotate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 9171102dd3ad..3eab6c29eaa5 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-12 23:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 23:00 [PATCH] perf annotate: Allow whitespace between insn operands Namhyung Kim
2023-06-12 23:55 ` Ian Rogers

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®