mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 22:03:17 +01: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 <[email protected]> Cc: Aditya Bodkhe <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Albert Ou <[email protected]> Cc: Alexandre Ghiti <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Chun-Tse Shao <[email protected]> Cc: Dmitriy Vyukov <[email protected]> Cc: Dr. David Alan Gilbert <[email protected]> Cc: Guo Ren <[email protected]> Cc: Haibo Xu <[email protected]> Cc: Howard Chu <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: John Garry <[email protected]> Cc: Krzysztof Łopatowski <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Wielaard <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sergei Trofimovich <[email protected]> Cc: Shimin Guo <[email protected]> Cc: Stephen Brennan <[email protected]> Cc: Thomas Falcon <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
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 */
|