| 1 |
|
| 2 | #ifndef PERF_LIBDW_H
|
| 3 | #define PERF_LIBDW_H
|
| 4 |
|
| 5 | #include <linux/types.h>
|
| 6 |
|
| 7 | struct dso;
|
| 8 | struct inline_node;
|
| 9 | struct symbol;
|
| 10 |
|
| 11 | #ifdef HAVE_LIBDW_SUPPORT
|
| 12 | |
| 13 | * libdw__addr2line - Convert address to source location using libdw
|
| 14 | * @addr: Address to resolve
|
| 15 | * @file: Pointer to return filename (caller must free)
|
| 16 | * @line_nr: Pointer to return line number
|
| 17 | * @dso: The dso struct
|
| 18 | * @unwind_inlines: Whether to unwind inline function calls
|
| 19 | * @node: Inline node list to append to
|
| 20 | * @sym: The symbol associated with the address
|
| 21 | *
|
| 22 | * This function initializes a Dwfl context for the DSO if not already present,
|
| 23 | * finds the source line information for the given address, and optionally
|
| 24 | * resolves inline function call chains.
|
| 25 | *
|
| 26 | * Returns 1 on success (found), 0 on failure (not found).
|
| 27 |
|
| 28 | int libdw__addr2line(u64 addr, char **file,
|
| 29 | unsigned int *line_nr, struct dso *dso,
|
| 30 | bool unwind_inlines, struct inline_node *node,
|
| 31 | struct symbol *sym);
|
| 32 |
|
| 33 | |
| 34 | * dso__free_libdw - Free libdw resources associated with the DSO
|
| 35 | * @dso: The dso to free resources for
|
| 36 | *
|
| 37 | * This function cleans up the Dwfl context used for addr2line lookups.
|
| 38 |
|
| 39 | void dso__free_libdw(struct dso *dso);
|
| 40 |
|
| 41 | #else
|
| 42 |
|
| 43 | static inline int libdw__addr2line(u64 addr __maybe_unused, char **file __maybe_unused,
|
| 44 | unsigned int *line_nr __maybe_unused,
|
| 45 | struct dso *dso __maybe_unused,
|
| 46 | bool unwind_inlines __maybe_unused,
|
| 47 | struct inline_node *node __maybe_unused,
|
| 48 | struct symbol *sym __maybe_unused)
|
| 49 | {
|
| 50 | return 0;
|
| 51 | }
|
| 52 |
|
| 53 | static inline void dso__free_libdw(struct dso *dso __maybe_unused)
|
| 54 | {
|
| 55 | }
|
| 56 | #endif
|
| 57 |
|
| 58 | #endif
|