1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/compiler.h>
6 #include <linux/types.h>
19 typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
21 struct unwind_libunwind_ops {
22 int (*prepare_access)(struct thread *thread);
23 void (*flush_access)(struct thread *thread);
24 void (*finish_access)(struct thread *thread);
25 int (*get_entries)(unwind_entry_cb_t cb, void *arg,
26 struct thread *thread,
27 struct perf_sample *data, int max_stack);
30 #ifdef HAVE_DWARF_UNWIND_SUPPORT
31 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
32 struct thread *thread,
33 struct perf_sample *data, int max_stack);
34 /* libunwind specific */
35 #ifdef HAVE_LIBUNWIND_SUPPORT
36 #ifndef LIBUNWIND__ARCH_REG_ID
37 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arch_reg_id(regnum)
40 #ifndef LIBUNWIND__ARCH_REG_SP
41 #define LIBUNWIND__ARCH_REG_SP PERF_REG_SP
44 #ifndef LIBUNWIND__ARCH_REG_IP
45 #define LIBUNWIND__ARCH_REG_IP PERF_REG_IP
48 int LIBUNWIND__ARCH_REG_ID(int regnum);
49 int unwind__prepare_access(struct thread *thread, struct map *map,
51 void unwind__flush_access(struct thread *thread);
52 void unwind__finish_access(struct thread *thread);
54 static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
55 struct map *map __maybe_unused,
56 bool *initialized __maybe_unused)
61 static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
62 static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
66 unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
67 void *arg __maybe_unused,
68 struct thread *thread __maybe_unused,
69 struct perf_sample *data __maybe_unused,
70 int max_stack __maybe_unused)
75 static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
76 struct map *map __maybe_unused,
77 bool *initialized __maybe_unused)
82 static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
83 static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
84 #endif /* HAVE_DWARF_UNWIND_SUPPORT */
85 #endif /* __UNWIND_H */