unwind.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef __UNWIND_H
  2. #define __UNWIND_H
  3. #include <linux/types.h>
  4. #include "event.h"
  5. #include "symbol.h"
  6. #include "thread.h"
  7. struct unwind_entry {
  8. struct map *map;
  9. struct symbol *sym;
  10. u64 ip;
  11. };
  12. typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
  13. #ifdef HAVE_DWARF_UNWIND_SUPPORT
  14. int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
  15. struct machine *machine,
  16. struct thread *thread,
  17. struct perf_sample *data, int max_stack);
  18. /* libunwind specific */
  19. #ifdef HAVE_LIBUNWIND_SUPPORT
  20. int libunwind__arch_reg_id(int regnum);
  21. int unwind__prepare_access(struct thread *thread);
  22. void unwind__finish_access(struct thread *thread);
  23. #else
  24. static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
  25. {
  26. return 0;
  27. }
  28. static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
  29. #endif
  30. #else
  31. static inline int
  32. unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
  33. void *arg __maybe_unused,
  34. struct machine *machine __maybe_unused,
  35. struct thread *thread __maybe_unused,
  36. struct perf_sample *data __maybe_unused,
  37. int max_stack __maybe_unused)
  38. {
  39. return 0;
  40. }
  41. static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
  42. {
  43. return 0;
  44. }
  45. static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
  46. #endif /* HAVE_DWARF_UNWIND_SUPPORT */
  47. #endif /* __UNWIND_H */