1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/compiler.h>
6 #include <linux/types.h>
20 typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
22 struct unwind_libunwind_ops {
23 int (*prepare_access)(struct map_groups *mg);
24 void (*flush_access)(struct map_groups *mg);
25 void (*finish_access)(struct map_groups *mg);
26 int (*get_entries)(unwind_entry_cb_t cb, void *arg,
27 struct thread *thread,
28 struct perf_sample *data, int max_stack);
31 #ifdef HAVE_DWARF_UNWIND_SUPPORT
32 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
33 struct thread *thread,
34 struct perf_sample *data, int max_stack);
35 /* libunwind specific */
36 #ifdef HAVE_LIBUNWIND_SUPPORT
37 #ifndef LIBUNWIND__ARCH_REG_ID
38 #define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arch_reg_id(regnum)
41 #ifndef LIBUNWIND__ARCH_REG_SP
42 #define LIBUNWIND__ARCH_REG_SP PERF_REG_SP
45 #ifndef LIBUNWIND__ARCH_REG_IP
46 #define LIBUNWIND__ARCH_REG_IP PERF_REG_IP
49 int LIBUNWIND__ARCH_REG_ID(int regnum);
50 int unwind__prepare_access(struct map_groups *mg, struct map *map,
52 void unwind__flush_access(struct map_groups *mg);
53 void unwind__finish_access(struct map_groups *mg);
55 static inline int unwind__prepare_access(struct map_groups *mg __maybe_unused,
56 struct map *map __maybe_unused,
57 bool *initialized __maybe_unused)
62 static inline void unwind__flush_access(struct map_groups *mg __maybe_unused) {}
63 static inline void unwind__finish_access(struct map_groups *mg __maybe_unused) {}
67 unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
68 void *arg __maybe_unused,
69 struct thread *thread __maybe_unused,
70 struct perf_sample *data __maybe_unused,
71 int max_stack __maybe_unused)
76 static inline int unwind__prepare_access(struct map_groups *mg __maybe_unused,
77 struct map *map __maybe_unused,
78 bool *initialized __maybe_unused)
83 static inline void unwind__flush_access(struct map_groups *mg __maybe_unused) {}
84 static inline void unwind__finish_access(struct map_groups *mg __maybe_unused) {}
85 #endif /* HAVE_DWARF_UNWIND_SUPPORT */
86 #endif /* __UNWIND_H */