xref: /openbmc/linux/tools/perf/util/unwind.h (revision 4a44a19b)
1 #ifndef __UNWIND_H
2 #define __UNWIND_H
3 
4 #include <linux/types.h>
5 #include "event.h"
6 #include "symbol.h"
7 #include "thread.h"
8 
9 struct unwind_entry {
10 	struct map	*map;
11 	struct symbol	*sym;
12 	u64		ip;
13 };
14 
15 typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
16 
17 #ifdef HAVE_DWARF_UNWIND_SUPPORT
18 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
19 			struct machine *machine,
20 			struct thread *thread,
21 			struct perf_sample *data, int max_stack);
22 /* libunwind specific */
23 #ifdef HAVE_LIBUNWIND_SUPPORT
24 int libunwind__arch_reg_id(int regnum);
25 int unwind__prepare_access(struct thread *thread);
26 void unwind__flush_access(struct thread *thread);
27 void unwind__finish_access(struct thread *thread);
28 #else
29 static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
30 {
31 	return 0;
32 }
33 
34 static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
35 static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
36 #endif
37 #else
38 static inline int
39 unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
40 		    void *arg __maybe_unused,
41 		    struct machine *machine __maybe_unused,
42 		    struct thread *thread __maybe_unused,
43 		    struct perf_sample *data __maybe_unused,
44 		    int max_stack __maybe_unused)
45 {
46 	return 0;
47 }
48 
49 static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
50 {
51 	return 0;
52 }
53 
54 static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
55 static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
56 #endif /* HAVE_DWARF_UNWIND_SUPPORT */
57 #endif /* __UNWIND_H */
58