2012-08-07 20:20:46 +07:00
|
|
|
#ifndef __UNWIND_H
|
|
|
|
#define __UNWIND_H
|
|
|
|
|
2014-04-26 02:31:02 +07:00
|
|
|
#include <linux/types.h>
|
2012-08-07 20:20:46 +07:00
|
|
|
#include "event.h"
|
|
|
|
#include "symbol.h"
|
2014-10-06 07:46:00 +07:00
|
|
|
#include "thread.h"
|
2012-08-07 20:20:46 +07:00
|
|
|
|
|
|
|
struct unwind_entry {
|
|
|
|
struct map *map;
|
|
|
|
struct symbol *sym;
|
|
|
|
u64 ip;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
|
|
|
|
|
2016-06-03 10:33:12 +07:00
|
|
|
struct unwind_libunwind_ops {
|
|
|
|
int (*prepare_access)(struct thread *thread);
|
|
|
|
void (*flush_access)(struct thread *thread);
|
|
|
|
void (*finish_access)(struct thread *thread);
|
|
|
|
int (*get_entries)(unwind_entry_cb_t cb, void *arg,
|
|
|
|
struct thread *thread,
|
|
|
|
struct perf_sample *data, int max_stack);
|
|
|
|
};
|
|
|
|
|
2014-01-07 19:47:28 +07:00
|
|
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
2012-08-07 20:20:46 +07:00
|
|
|
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
|
|
|
|
struct thread *thread,
|
2013-11-14 03:40:36 +07:00
|
|
|
struct perf_sample *data, int max_stack);
|
2014-01-07 19:47:28 +07:00
|
|
|
/* libunwind specific */
|
|
|
|
#ifdef HAVE_LIBUNWIND_SUPPORT
|
2014-01-07 19:47:27 +07:00
|
|
|
int libunwind__arch_reg_id(int regnum);
|
2016-06-03 10:33:19 +07:00
|
|
|
int unwind__prepare_access(struct thread *thread, struct map *map);
|
2014-10-06 07:46:01 +07:00
|
|
|
void unwind__flush_access(struct thread *thread);
|
2014-10-06 07:46:00 +07:00
|
|
|
void unwind__finish_access(struct thread *thread);
|
|
|
|
#else
|
2016-06-03 10:33:19 +07:00
|
|
|
static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
|
|
|
|
struct map *map __maybe_unused)
|
2014-10-06 07:46:00 +07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-10-06 07:46:01 +07:00
|
|
|
static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
|
2014-10-06 07:46:00 +07:00
|
|
|
static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
|
2014-01-07 19:47:28 +07:00
|
|
|
#endif
|
2012-08-07 20:20:46 +07:00
|
|
|
#else
|
|
|
|
static inline int
|
2012-09-11 05:15:03 +07:00
|
|
|
unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
|
|
|
|
void *arg __maybe_unused,
|
|
|
|
struct thread *thread __maybe_unused,
|
2013-11-14 03:40:36 +07:00
|
|
|
struct perf_sample *data __maybe_unused,
|
|
|
|
int max_stack __maybe_unused)
|
2012-08-07 20:20:46 +07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2014-10-06 07:46:00 +07:00
|
|
|
|
2016-06-03 10:33:19 +07:00
|
|
|
static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
|
|
|
|
struct map *map __maybe_unused)
|
2014-10-06 07:46:00 +07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-10-06 07:46:01 +07:00
|
|
|
static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
|
2014-10-06 07:46:00 +07:00
|
|
|
static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
|
2014-01-07 19:47:28 +07:00
|
|
|
#endif /* HAVE_DWARF_UNWIND_SUPPORT */
|
2012-08-07 20:20:46 +07:00
|
|
|
#endif /* __UNWIND_H */
|