mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
Rather than have 2 Dwfl unify the Dwfl in skip-callchain-idx with that is used by libdw__addr2line(). Rename that variable in 'struct dso' from 'a2l_libdw' to just 'libdw' as it is now used in more than addr2line. The Dwfl in skip-callchain-idx uses a map address when being read with dwfl_report_elf (rather than dwfl_report_offline that addr2line uses). skip-callchain-idx is wrong as the map address can vary between processes because of ASLR, ie it should need a different Dwfl per process. In the code after this patch the base address becomes 0 and the mapped PC is used with the dwfl functions. This should increase the accuracy of skip-callchain-idx, but the impact has only been build tested. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Alexandre Ghiti <alex@ghiti.fr> Cc: Andi Kleen <ak@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.ibm.com> Cc: Chun-Tse Shao <ctshao@google.com> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Dr. David Alan Gilbert <linux@treblig.org> Cc: Guo Ren <guoren@kernel.org> Cc: Haibo Xu <haibo1.xu@intel.com> Cc: Howard Chu <howardchu95@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com> Cc: Leo Yan <leo.yan@linux.dev> Cc: Mark Wielaard <mark@klomp.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Walmsley <pjw@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sergei Trofimovich <slyich@gmail.com> Cc: Shimin Guo <shimin.guo@skydio.com> Cc: Stephen Brennan <stephen.s.brennan@oracle.com> Cc: Thomas Falcon <thomas.falcon@intel.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
59 lines
1.7 KiB
C
59 lines
1.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef PERF_LIBDW_H
|
|
#define PERF_LIBDW_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct dso;
|
|
struct inline_node;
|
|
struct symbol;
|
|
|
|
#ifdef HAVE_LIBDW_SUPPORT
|
|
/*
|
|
* libdw__addr2line - Convert address to source location using libdw
|
|
* @addr: Address to resolve
|
|
* @file: Pointer to return filename (caller must free)
|
|
* @line_nr: Pointer to return line number
|
|
* @dso: The dso struct
|
|
* @unwind_inlines: Whether to unwind inline function calls
|
|
* @node: Inline node list to append to
|
|
* @sym: The symbol associated with the address
|
|
*
|
|
* This function initializes a Dwfl context for the DSO if not already present,
|
|
* finds the source line information for the given address, and optionally
|
|
* resolves inline function call chains.
|
|
*
|
|
* Returns 1 on success (found), 0 on failure (not found).
|
|
*/
|
|
int libdw__addr2line(u64 addr, char **file,
|
|
unsigned int *line_nr, struct dso *dso,
|
|
bool unwind_inlines, struct inline_node *node,
|
|
struct symbol *sym);
|
|
|
|
/*
|
|
* dso__free_libdw - Free libdw resources associated with the DSO
|
|
* @dso: The dso to free resources for
|
|
*
|
|
* This function cleans up the Dwfl context used for addr2line lookups.
|
|
*/
|
|
void dso__free_libdw(struct dso *dso);
|
|
|
|
#else /* HAVE_LIBDW_SUPPORT */
|
|
|
|
static inline int libdw__addr2line(u64 addr __maybe_unused, char **file __maybe_unused,
|
|
unsigned int *line_nr __maybe_unused,
|
|
struct dso *dso __maybe_unused,
|
|
bool unwind_inlines __maybe_unused,
|
|
struct inline_node *node __maybe_unused,
|
|
struct symbol *sym __maybe_unused)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void dso__free_libdw(struct dso *dso __maybe_unused)
|
|
{
|
|
}
|
|
#endif /* HAVE_LIBDW_SUPPORT */
|
|
|
|
#endif /* PERF_LIBDW_H */
|