summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/dwarf-aux.h
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2024-01-17 07:26:55 +0100
committerNamhyung Kim <namhyung@kernel.org>2024-01-22 21:08:20 +0100
commit6fed025f119d229cf345aed2207d2922ed71871d (patch)
tree71971ec6f49d6e01c10190e3014305d5ecd557ff /tools/perf/util/dwarf-aux.h
parentperf annotate-data: Support global variables (diff)
downloadlinux-6fed025f119d229cf345aed2207d2922ed71871d.tar.xz
linux-6fed025f119d229cf345aed2207d2922ed71871d.zip
perf dwarf-aux: Add die_get_cfa()
The die_get_cfa() is to get frame base register and offset at the given instruction address (pc). This info will be used to locate stack variables which have location expression using DW_OP_fbreg. 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-8-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/util/dwarf-aux.h')
-rw-r--r--tools/perf/util/dwarf-aux.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h
index 4e64caac6df8..f209f9162908 100644
--- a/tools/perf/util/dwarf-aux.h
+++ b/tools/perf/util/dwarf-aux.h
@@ -177,4 +177,19 @@ static inline Dwarf_Die *die_find_variable_by_addr(Dwarf_Die *sc_die __maybe_unu
#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT */
+#ifdef HAVE_DWARF_CFI_SUPPORT
+
+/* Get the frame base information from CFA */
+int die_get_cfa(Dwarf *dwarf, u64 pc, int *preg, int *poffset);
+
+#else /* HAVE_DWARF_CFI_SUPPORT */
+
+static inline int die_get_cfa(Dwarf *dwarf __maybe_unused, u64 pc __maybe_unused,
+ int *preg __maybe_unused, int *poffset __maybe_unused)
+{
+ return -1;
+}
+
+#endif /* HAVE_DWARF_CFI_SUPPORT */
+
#endif /* _DWARF_AUX_H */