blob: c17c4855bdbc3e4bcf8423246c92b8f7bc750494 [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,
19 struct machine *machine,
20 struct thread *thread,
Arnaldo Carvalho de Melo37676af2013-11-13 17:40:36 -030021 struct perf_sample *data, int max_stack);
Jiri Olsa9ff125d2014-01-07 13:47:28 +010022/* libunwind specific */
23#ifdef HAVE_LIBUNWIND_SUPPORT
Jiri Olsaea3da692014-01-07 13:47:27 +010024int libunwind__arch_reg_id(int regnum);
Namhyung Kim66f066d82014-10-06 09:46:00 +090025int unwind__prepare_access(struct thread *thread);
26void 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
33static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
Jiri Olsa9ff125d2014-01-07 13:47:28 +010034#endif
Jiri Olsa71ad0f52012-08-07 15:20:46 +020035#else
36static inline int
Irina Tirdea1d037ca2012-09-11 01:15:03 +030037unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
38 void *arg __maybe_unused,
39 struct machine *machine __maybe_unused,
40 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
52static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
Jiri Olsa9ff125d2014-01-07 13:47:28 +010053#endif /* HAVE_DWARF_UNWIND_SUPPORT */
Jiri Olsa71ad0f52012-08-07 15:20:46 +020054#endif /* __UNWIND_H */