]> git.itanic.dy.fi Git - linux-stable/commit
perf dwarf-aux: Add die_find_variable_by_reg() helper
authorNamhyung Kim <namhyung@kernel.org>
Thu, 9 Nov 2023 23:59:26 +0000 (15:59 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 10 Nov 2023 12:04:12 +0000 (09:04 -0300)
commit3f5928e461e394d27bc1ed7d0785b1e63c43d6a1
tree4eea36c6b045a2cf6b64bc4feb962eae9dd47d37
parent981620fd2776c45a514ed621a718e2a6941ad7c5
perf dwarf-aux: Add die_find_variable_by_reg() helper

The die_find_variable_by_reg() will search for a variable or a parameter
sub-DIE in the given scope DIE where the location matches to the given
register.

For the simplest and most common case, memory access usually happens
with a base register and an offset to the field so the register holds a
pointer in a variable or function parameter.  Then we can find one if it
has a location expression at the (instruction) address.  This function
only handles such a simple case for now.

In this case, the expression has a DW_OP_regN operation where N < 32.
If the register index (N) is greater than or equal to 32, DW_OP_regx
operation with an operand which saves the value for the N would be used.
It rejects expressions with more operations.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: linux-toolchains@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Link: https://lore.kernel.org/r/20231110000012.3538610-8-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/dwarf-aux.c
tools/perf/util/dwarf-aux.h