Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 1 | #ifndef __UNWIND_H |
| 2 | #define __UNWIND_H |
| 3 | |
Borislav Petkov | d944c4e | 2014-04-25 21:31:02 +0200 | [diff] [blame] | 4 | #include <linux/types.h> |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 5 | #include "event.h" |
| 6 | #include "symbol.h" |
Namhyung Kim | 66f066d8 | 2014-10-06 09:46:00 +0900 | [diff] [blame] | 7 | #include "thread.h" |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 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 | |
Jiri Olsa | 9ff125d | 2014-01-07 13:47:28 +0100 | [diff] [blame] | 17 | #ifdef HAVE_DWARF_UNWIND_SUPPORT |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 18 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 19 | struct thread *thread, |
Arnaldo Carvalho de Melo | 37676af | 2013-11-13 17:40:36 -0300 | [diff] [blame] | 20 | struct perf_sample *data, int max_stack); |
Jiri Olsa | 9ff125d | 2014-01-07 13:47:28 +0100 | [diff] [blame] | 21 | /* libunwind specific */ |
| 22 | #ifdef HAVE_LIBUNWIND_SUPPORT |
Jiri Olsa | ea3da69 | 2014-01-07 13:47:27 +0100 | [diff] [blame] | 23 | int libunwind__arch_reg_id(int regnum); |
Namhyung Kim | 66f066d8 | 2014-10-06 09:46:00 +0900 | [diff] [blame] | 24 | int unwind__prepare_access(struct thread *thread); |
Namhyung Kim | 380b514 | 2014-10-06 09:46:01 +0900 | [diff] [blame] | 25 | void unwind__flush_access(struct thread *thread); |
Namhyung Kim | 66f066d8 | 2014-10-06 09:46:00 +0900 | [diff] [blame] | 26 | void unwind__finish_access(struct thread *thread); |
| 27 | #else |
| 28 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused) |
| 29 | { |
| 30 | return 0; |
| 31 | } |
| 32 | |
Namhyung Kim | 380b514 | 2014-10-06 09:46:01 +0900 | [diff] [blame] | 33 | static inline void unwind__flush_access(struct thread *thread __maybe_unused) {} |
Namhyung Kim | 66f066d8 | 2014-10-06 09:46:00 +0900 | [diff] [blame] | 34 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} |
Jiri Olsa | 9ff125d | 2014-01-07 13:47:28 +0100 | [diff] [blame] | 35 | #endif |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 36 | #else |
| 37 | static inline int |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame] | 38 | unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, |
| 39 | void *arg __maybe_unused, |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame] | 40 | struct thread *thread __maybe_unused, |
Arnaldo Carvalho de Melo | 37676af | 2013-11-13 17:40:36 -0300 | [diff] [blame] | 41 | struct perf_sample *data __maybe_unused, |
| 42 | int max_stack __maybe_unused) |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 43 | { |
| 44 | return 0; |
| 45 | } |
Namhyung Kim | 66f066d8 | 2014-10-06 09:46:00 +0900 | [diff] [blame] | 46 | |
| 47 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused) |
| 48 | { |
| 49 | return 0; |
| 50 | } |
| 51 | |
Namhyung Kim | 380b514 | 2014-10-06 09:46:01 +0900 | [diff] [blame] | 52 | static inline void unwind__flush_access(struct thread *thread __maybe_unused) {} |
Namhyung Kim | 66f066d8 | 2014-10-06 09:46:00 +0900 | [diff] [blame] | 53 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} |
Jiri Olsa | 9ff125d | 2014-01-07 13:47:28 +0100 | [diff] [blame] | 54 | #endif /* HAVE_DWARF_UNWIND_SUPPORT */ |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 55 | #endif /* __UNWIND_H */ |