perf annotate-data: Handle array style accesses
authorNamhyung Kim <namhyung@kernel.org>
Wed, 17 Jan 2024 06:26:51 +0000 (22:26 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Mon, 22 Jan 2024 20:08:19 +0000 (12:08 -0800)
commitd3030191d3a6292408c5cf999ebcc1d10e00e9c2
treeb0722a4a99b653e35c08faf71325bf7735c46b22
parent1cf4df0373eed561f543a9e0e0ac2498384d67a0
perf annotate-data: Handle array style accesses

On x86, instructions for array access often looks like below.

  mov  0x1234(%rax,%rbx,8), %rcx

Usually the first register holds the type information and the second one
has the index.  And the current code only looks up a variable for the
first register.  But it's possible to be in the other way around so it
needs to check the second register if the first one failed.

The stat changed like this.

  Annotate data type stats:
  total 294, ok 148 (50.3%), bad 146 (49.7%)
  -----------------------------------------------------------
          30 : no_sym
          32 : no_mem_ops
          66 : no_var
          10 : no_typeinfo
           8 : bad_offset

Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20240117062657.985479-4-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/annotate-data.c
tools/perf/util/annotate-data.h
tools/perf/util/annotate.c
tools/perf/util/annotate.h