summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/Build
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2023-12-13 01:13:09 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-12-24 02:39:18 +0100
commitb9c87f536c6f28c75ace8a014646faad00f0e1ec (patch)
tree691d1a07dc80a650d3266ac946423ef102c1e811 /tools/perf/util/Build
parentperf dwarf-regs: Add get_dwarf_regnum() (diff)
downloadlinux-b9c87f536c6f28c75ace8a014646faad00f0e1ec.tar.xz
linux-b9c87f536c6f28c75ace8a014646faad00f0e1ec.zip
perf annotate-data: Add find_data_type() to get type from memory access
The find_data_type() is to get a data type from the memory access at the given address (IP) using a register and an offset. It requires DWARF debug info in the DSO and searches the list of variables and function parameters in the scope. In a pseudo code, it does basically the following: find_data_type(dso, ip, reg, offset) { pc = map__rip_2objdump(ip); CU = dwarf_addrdie(dso->dwarf, pc); scopes = die_get_scopes(CU, pc); for_each_scope(S, scopes) { V = die_find_variable_by_reg(S, pc, reg); if (V && V.type == pointer_type) { T = die_get_real_type(V); if (offset < T.size) return T; } } return NULL; } Committer notes: The 'size' variable in check_variable() is 64-bit, so use PRIu64 and inttypes.h to debug it. Ditto at find_data_type_die(). Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@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: Masami Hiramatsu <mhiramat@kernel.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/20231213001323.718046-4-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/Build')
-rw-r--r--tools/perf/util/Build1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 132508ebe125..8027f450fa3e 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -196,6 +196,7 @@ perf-$(CONFIG_DWARF) += probe-finder.o
perf-$(CONFIG_DWARF) += dwarf-aux.o
perf-$(CONFIG_DWARF) += dwarf-regs.o
perf-$(CONFIG_DWARF) += debuginfo.o
+perf-$(CONFIG_DWARF) += annotate-data.o
perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind-local.o