From 9231261d73ddd9a250b776e2e25c224a596ece59 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Wed, 26 Feb 2020 02:11:51 +0100 Subject: [PATCH] Retrieve image name on unix. --- client/TracyCallstack.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/TracyCallstack.cpp b/client/TracyCallstack.cpp index bb22f224..87cc8137 100644 --- a/client/TracyCallstack.cpp +++ b/client/TracyCallstack.cpp @@ -484,7 +484,12 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr ) cb_num = 0; backtrace_pcinfo( cb_bts, ptr, CallstackDataCb, CallstackErrorCb, nullptr ); assert( cb_num > 0 ); - return { cb_data, uint8_t( cb_num ) }; + + const char* symloc = nullptr; + Dl_info dlinfo; + if( dladdr( (void*)ptr, &dlinfo ) ) symloc = dlinfo.dli_fname; + + return { cb_data, uint8_t( cb_num ), CopyString( symloc ? symloc : "[unknown]" ) }; } #elif TRACY_HAS_CALLSTACK == 5