unwind.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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__flush_access(struct thread *thread);
  23. void unwind__finish_access(struct thread *thread);
  24. #else
  25. static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
  26. {
  27. return 0;
  28. }
  29. static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
  30. static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
  31. #endif
  32. #else
  33. static inline int
  34. unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
  35. void *arg __maybe_unused,
  36. struct machine *machine __maybe_unused,
  37. struct thread *thread __maybe_unused,
  38. struct perf_sample *data __maybe_unused,
  39. int max_stack __maybe_unused)
  40. {
  41. return 0;
  42. }
  43. static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
  44. {
  45. return 0;
  46. }
  47. static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
  48. static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
  49. #endif /* HAVE_DWARF_UNWIND_SUPPORT */
  50. #endif /* __UNWIND_H */