2012-08-07 13:20:46 +00:00
|
|
|
#ifndef __UNWIND_H
|
|
|
|
#define __UNWIND_H
|
|
|
|
|
2017-04-19 16:28:30 +00:00
|
|
|
#include <linux/compiler.h>
|
2014-04-25 19:31:02 +00:00
|
|
|
#include <linux/types.h>
|
2017-04-19 16:28:30 +00:00
|
|
|
|
|
|
|
struct map;
|
|
|
|
struct perf_sample;
|
|
|
|
struct symbol;
|
|
|
|
struct thread;
|
2012-08-07 13:20:46 +00: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 03:33:12 +00: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 12:47:28 +00:00
|
|
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
2012-08-07 13:20:46 +00:00
|
|
|
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
|
|
|
|
struct thread *thread,
|
2013-11-13 20:40:36 +00:00
|
|
|
struct perf_sample *data, int max_stack);
|
2014-01-07 12:47:28 +00:00
|
|
|
/* libunwind specific */
|
|
|
|
#ifdef HAVE_LIBUNWIND_SUPPORT
|
2016-06-03 03:33:20 +00:00
|
|
|
#ifndef LIBUNWIND__ARCH_REG_ID
|
|
|
|
#define LIBUNWIND__ARCH_REG_ID(regnum) libunwind__arch_reg_id(regnum)
|
|
|
|
#endif
|
2016-06-22 06:57:02 +00:00
|
|
|
|
|
|
|
#ifndef LIBUNWIND__ARCH_REG_SP
|
|
|
|
#define LIBUNWIND__ARCH_REG_SP PERF_REG_SP
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LIBUNWIND__ARCH_REG_IP
|
|
|
|
#define LIBUNWIND__ARCH_REG_IP PERF_REG_IP
|
|
|
|
#endif
|
|
|
|
|
2016-06-03 03:33:20 +00:00
|
|
|
int LIBUNWIND__ARCH_REG_ID(int regnum);
|
2016-07-04 12:16:22 +00:00
|
|
|
int unwind__prepare_access(struct thread *thread, struct map *map,
|
|
|
|
bool *initialized);
|
2014-10-06 00:46:01 +00:00
|
|
|
void unwind__flush_access(struct thread *thread);
|
2014-10-06 00:46:00 +00:00
|
|
|
void unwind__finish_access(struct thread *thread);
|
|
|
|
#else
|
2016-06-03 03:33:19 +00:00
|
|
|
static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
|
2016-07-04 12:16:22 +00:00
|
|
|
struct map *map __maybe_unused,
|
|
|
|
bool *initialized __maybe_unused)
|
2014-10-06 00:46:00 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-10-06 00:46:01 +00:00
|
|
|
static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
|
2014-10-06 00:46:00 +00:00
|
|
|
static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
|
2014-01-07 12:47:28 +00:00
|
|
|
#endif
|
2012-08-07 13:20:46 +00:00
|
|
|
#else
|
|
|
|
static inline int
|
2012-09-10 22:15:03 +00:00
|
|
|
unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
|
|
|
|
void *arg __maybe_unused,
|
|
|
|
struct thread *thread __maybe_unused,
|
2013-11-13 20:40:36 +00:00
|
|
|
struct perf_sample *data __maybe_unused,
|
|
|
|
int max_stack __maybe_unused)
|
2012-08-07 13:20:46 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2014-10-06 00:46:00 +00:00
|
|
|
|
2016-06-03 03:33:19 +00:00
|
|
|
static inline int unwind__prepare_access(struct thread *thread __maybe_unused,
|
2016-07-04 12:16:22 +00:00
|
|
|
struct map *map __maybe_unused,
|
|
|
|
bool *initialized __maybe_unused)
|
2014-10-06 00:46:00 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-10-06 00:46:01 +00:00
|
|
|
static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
|
2014-10-06 00:46:00 +00:00
|
|
|
static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
|
2014-01-07 12:47:28 +00:00
|
|
|
#endif /* HAVE_DWARF_UNWIND_SUPPORT */
|
2012-08-07 13:20:46 +00:00
|
|
|
#endif /* __UNWIND_H */
|