Fix addr2line invokation

This commit is contained in:
Jack Andersen 2017-11-01 23:20:23 -10:00
parent f8ab0e03ba
commit bfe0c1ccad
1 changed files with 8 additions and 0 deletions

View File

@ -152,7 +152,15 @@ void logvisorAbort()
std::string cmdLineStr = cmdLine; std::string cmdLineStr = cmdLine;
for (size_t i = 0; i < size; i++) for (size_t i = 0; i < size; i++)
{ {
#if __linux__
Dl_info dlip;
if (dladdr(array[i], &dlip))
snprintf(cmdLine, 128, " %p", (void*)((uint8_t*)array[i] - (uint8_t*)dlip.dli_fbase));
else
snprintf(cmdLine, 128, " %p", array[i]); snprintf(cmdLine, 128, " %p", array[i]);
#else
snprintf(cmdLine, 128, " %p", array[i]);
#endif
cmdLineStr += cmdLine; cmdLineStr += cmdLine;
} }