Dl_info doesn't destroy data.

This commit is contained in:
Bartosz Taudul 2020-02-27 13:28:45 +01:00
parent 5f6b3d2cd5
commit 9ae71ac4ee

View File

@ -379,7 +379,7 @@ static int SymbolAddressDataCb( void* data, uintptr_t pc, const char* fn, int li
if( !fn ) if( !fn )
{ {
const char* symloc = nullptr; const char* symloc = nullptr;
static Dl_info dlinfo; Dl_info dlinfo;
if( dladdr( (void*)ptr, &dlinfo ) ) symloc = dlinfo.dli_fname; if( dladdr( (void*)ptr, &dlinfo ) ) symloc = dlinfo.dli_fname;
if( !symloc ) symloc = "[unknown]"; if( !symloc ) symloc = "[unknown]";
sym.file = symloc; sym.file = symloc;
@ -581,7 +581,7 @@ const char* DecodeCallstackPtrFast( uint64_t ptr )
SymbolData DecodeSymbolAddress( uint64_t ptr ) SymbolData DecodeSymbolAddress( uint64_t ptr )
{ {
const char* symloc = nullptr; const char* symloc = nullptr;
static Dl_info dlinfo; Dl_info dlinfo;
if( dladdr( (void*)ptr, &dlinfo ) ) symloc = dlinfo.dli_fname; if( dladdr( (void*)ptr, &dlinfo ) ) symloc = dlinfo.dli_fname;
if( !symloc ) symloc = "[unknown]"; if( !symloc ) symloc = "[unknown]";
return SymbolData { symloc, 0, false }; return SymbolData { symloc, 0, false };