blob: 12790cf94618eddb9cdcec8607792f57e75a73c8 [file] [log] [blame]
Jiri Olsa71ad0f52012-08-07 15:20:46 +02001#ifndef __UNWIND_H
2#define __UNWIND_H
3
Borislav Petkovd944c4e2014-04-25 21:31:02 +02004#include <linux/types.h>
Jiri Olsa71ad0f52012-08-07 15:20:46 +02005#include "event.h"
6#include "symbol.h"
Namhyung Kim66f066d82014-10-06 09:46:00 +09007#include "thread.h"
Jiri Olsa71ad0f52012-08-07 15:20:46 +02008
9struct unwind_entry {
10 struct map *map;
11 struct symbol *sym;
12 u64 ip;
13};
14
15typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
16
Jiri Olsa9ff125d2014-01-07 13:47:28 +010017#ifdef HAVE_DWARF_UNWIND_SUPPORT
Jiri Olsa71ad0f52012-08-07 15:20:46 +020018int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
Jiri Olsa71ad0f52012-08-07 15:20:46 +020019 struct thread *thread,
Arnaldo Carvalho de Melo37676af2013-11-13 17:40:36 -030020 struct perf_sample *data, int max_stack);
Jiri Olsa9ff125d2014-01-07 13:47:28 +010021/* libunwind specific */
22#ifdef HAVE_LIBUNWIND_SUPPORT
Jiri Olsaea3da692014-01-07 13:47:27 +010023int libunwind__arch_reg_id(int regnum);
Namhyung Kim66f066d82014-10-06 09:46:00 +090024int unwind__prepare_access(struct thread *thread);
Namhyung Kim380b5142014-10-06 09:46:01 +090025void unwind__flush_access(struct thread *thread);
Namhyung Kim66f066d82014-10-06 09:46:00 +090026void unwind__finish_access(struct thread *thread);
27#else
28static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
29{
30 return 0;
31}
32
Namhyung Kim380b5142014-10-06 09:46:01 +090033static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
Namhyung Kim66f066d82014-10-06 09:46:00 +090034static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
Jiri Olsa9ff125d2014-01-07 13:47:28 +010035#endif
Jiri Olsa71ad0f52012-08-07 15:20:46 +020036#else
37static inline int
Irina Tirdea1d037ca2012-09-11 01:15:03 +030038unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
39 void *arg __maybe_unused,
Irina Tirdea1d037ca2012-09-11 01:15:03 +030040 struct thread *thread __maybe_unused,
Arnaldo Carvalho de Melo37676af2013-11-13 17:40:36 -030041 struct perf_sample *data __maybe_unused,
42 int max_stack __maybe_unused)
Jiri Olsa71ad0f52012-08-07 15:20:46 +020043{
44 return 0;
45}
Namhyung Kim66f066d82014-10-06 09:46:00 +090046
47static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
48{
49 return 0;
50}
51
Namhyung Kim380b5142014-10-06 09:46:01 +090052static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
Namhyung Kim66f066d82014-10-06 09:46:00 +090053static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
Jiri Olsa9ff125d2014-01-07 13:47:28 +010054#endif /* HAVE_DWARF_UNWIND_SUPPORT */
Jiri Olsa71ad0f52012-08-07 15:20:46 +020055#endif /* __UNWIND_H */