16f1b6291SNamhyung Kim /* SPDX-License-Identifier: GPL-2.0-or-later */ 26f1b6291SNamhyung Kim #ifndef _PERF_DEBUGINFO_H 36f1b6291SNamhyung Kim #define _PERF_DEBUGINFO_H 46f1b6291SNamhyung Kim 56f1b6291SNamhyung Kim #include <errno.h> 66f1b6291SNamhyung Kim #include <linux/compiler.h> 76f1b6291SNamhyung Kim 86f1b6291SNamhyung Kim #ifdef HAVE_DWARF_SUPPORT 96f1b6291SNamhyung Kim 106f1b6291SNamhyung Kim #include "dwarf-aux.h" 116f1b6291SNamhyung Kim 126f1b6291SNamhyung Kim /* debug information structure */ 136f1b6291SNamhyung Kim struct debuginfo { 146f1b6291SNamhyung Kim Dwarf *dbg; 156f1b6291SNamhyung Kim Dwfl_Module *mod; 166f1b6291SNamhyung Kim Dwfl *dwfl; 176f1b6291SNamhyung Kim Dwarf_Addr bias; 186f1b6291SNamhyung Kim const unsigned char *build_id; 196f1b6291SNamhyung Kim }; 206f1b6291SNamhyung Kim 216f1b6291SNamhyung Kim /* This also tries to open distro debuginfo */ 226f1b6291SNamhyung Kim struct debuginfo *debuginfo__new(const char *path); 236f1b6291SNamhyung Kim void debuginfo__delete(struct debuginfo *dbg); 246f1b6291SNamhyung Kim 256f1b6291SNamhyung Kim int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs, 266f1b6291SNamhyung Kim bool adjust_offset); 276f1b6291SNamhyung Kim 286f1b6291SNamhyung Kim #else /* HAVE_DWARF_SUPPORT */ 296f1b6291SNamhyung Kim 306f1b6291SNamhyung Kim /* dummy debug information structure */ 316f1b6291SNamhyung Kim struct debuginfo { 326f1b6291SNamhyung Kim }; 336f1b6291SNamhyung Kim 346f1b6291SNamhyung Kim static inline struct debuginfo *debuginfo__new(const char *path __maybe_unused) 356f1b6291SNamhyung Kim { 366f1b6291SNamhyung Kim return NULL; 376f1b6291SNamhyung Kim } 386f1b6291SNamhyung Kim 396f1b6291SNamhyung Kim static inline void debuginfo__delete(struct debuginfo *dbg __maybe_unused) 406f1b6291SNamhyung Kim { 416f1b6291SNamhyung Kim } 426f1b6291SNamhyung Kim 43*13d675aeSArnaldo Carvalho de Melo typedef void Dwarf_Addr; 44*13d675aeSArnaldo Carvalho de Melo 456f1b6291SNamhyung Kim static inline int debuginfo__get_text_offset(struct debuginfo *dbg __maybe_unused, 466f1b6291SNamhyung Kim Dwarf_Addr *offs __maybe_unused, 476f1b6291SNamhyung Kim bool adjust_offset __maybe_unused) 486f1b6291SNamhyung Kim { 496f1b6291SNamhyung Kim return -EINVAL; 506f1b6291SNamhyung Kim } 516f1b6291SNamhyung Kim 526f1b6291SNamhyung Kim #endif /* HAVE_DWARF_SUPPORT */ 536f1b6291SNamhyung Kim 546f1b6291SNamhyung Kim #ifdef HAVE_DEBUGINFOD_SUPPORT 556f1b6291SNamhyung Kim int get_source_from_debuginfod(const char *raw_path, const char *sbuild_id, 566f1b6291SNamhyung Kim char **new_path); 576f1b6291SNamhyung Kim #else /* HAVE_DEBUGINFOD_SUPPORT */ 586f1b6291SNamhyung Kim static inline int get_source_from_debuginfod(const char *raw_path __maybe_unused, 596f1b6291SNamhyung Kim const char *sbuild_id __maybe_unused, 606f1b6291SNamhyung Kim char **new_path __maybe_unused) 616f1b6291SNamhyung Kim { 626f1b6291SNamhyung Kim return -ENOTSUP; 636f1b6291SNamhyung Kim } 646f1b6291SNamhyung Kim #endif /* HAVE_DEBUGINFOD_SUPPORT */ 656f1b6291SNamhyung Kim 666f1b6291SNamhyung Kim #endif /* _PERF_DEBUGINFO_H */ 67