unwind.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 thread *thread,
  16. struct perf_sample *data, int max_stack);
  17. /* libunwind specific */
  18. #ifdef HAVE_LIBUNWIND_SUPPORT
  19. int libunwind__arch_reg_id(int regnum);
  20. int unwind__prepare_access(struct thread *thread);
  21. void unwind__flush_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__flush_access(struct thread *thread __maybe_unused) {}
  29. static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
  30. #endif
  31. #else
  32. static inline int
  33. unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
  34. void *arg __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__flush_access(struct thread *thread __maybe_unused) {}
  46. static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
  47. #endif /* HAVE_DWARF_UNWIND_SUPPORT */
  48. #endif /* __UNWIND_H */