debuginfo.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef _PERF_DEBUGINFO_H
  3. #define _PERF_DEBUGINFO_H
  4. #include <errno.h>
  5. #include <linux/compiler.h>
  6. #ifdef HAVE_LIBDW_SUPPORT
  7. #include "dwarf-aux.h"
  8. /* debug information structure */
  9. struct debuginfo {
  10. Dwarf *dbg;
  11. Dwfl_Module *mod;
  12. Dwfl *dwfl;
  13. Dwarf_Addr bias;
  14. const unsigned char *build_id;
  15. };
  16. /* This also tries to open distro debuginfo */
  17. struct debuginfo *debuginfo__new(const char *path);
  18. void debuginfo__delete(struct debuginfo *dbg);
  19. int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs,
  20. bool adjust_offset);
  21. #else /* HAVE_LIBDW_SUPPORT */
  22. /* dummy debug information structure */
  23. struct debuginfo {
  24. };
  25. static inline struct debuginfo *debuginfo__new(const char *path __maybe_unused)
  26. {
  27. return NULL;
  28. }
  29. static inline void debuginfo__delete(struct debuginfo *dbg __maybe_unused)
  30. {
  31. }
  32. typedef void Dwarf_Addr;
  33. static inline int debuginfo__get_text_offset(struct debuginfo *dbg __maybe_unused,
  34. Dwarf_Addr *offs __maybe_unused,
  35. bool adjust_offset __maybe_unused)
  36. {
  37. return -EINVAL;
  38. }
  39. #endif /* HAVE_LIBDW_SUPPORT */
  40. #ifdef HAVE_DEBUGINFOD_SUPPORT
  41. int get_source_from_debuginfod(const char *raw_path, const char *sbuild_id,
  42. char **new_path);
  43. #else /* HAVE_DEBUGINFOD_SUPPORT */
  44. static inline int get_source_from_debuginfod(const char *raw_path __maybe_unused,
  45. const char *sbuild_id __maybe_unused,
  46. char **new_path __maybe_unused)
  47. {
  48. return -ENOTSUP;
  49. }
  50. #endif /* HAVE_DEBUGINFOD_SUPPORT */
  51. #endif /* _PERF_DEBUGINFO_H */