From 4559120821ef69882d3a527c004f96eacd585d0c Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 30 Apr 2022 21:46:36 +0200 Subject: [PATCH] Get descriptors using debuginfod, if not available otherwise. --- libbacktrace/elf.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libbacktrace/elf.cpp b/libbacktrace/elf.cpp index 88de1f08..07206306 100644 --- a/libbacktrace/elf.cpp +++ b/libbacktrace/elf.cpp @@ -70,6 +70,10 @@ POSSIBILITY OF SUCH DAMAGE. */ namespace tracy { +#ifdef TRACY_DEBUGINFOD +int GetDebugInfoDescriptor( const char* buildid_data, size_t buildid_size ); +#endif + #if !defined(HAVE_DECL_STRNLEN) || !HAVE_DECL_STRNLEN /* If strnlen is not declared, provide our own version. */ @@ -913,7 +917,14 @@ elf_open_debugfile_by_buildid (struct backtrace_state *state, That seems kind of pointless to me--why would it have the right name but not the right build ID?--so skipping the check. */ +#ifdef TRACY_DEBUGINFOD + if (ret == -1) + return GetDebugInfoDescriptor( buildid_data, buildid_size ); + else + return ret; +#else return ret; +#endif } /* Try to open a file whose name is PREFIX (length PREFIX_LEN)