Improve callstack values for cases of missing symbols

This commit is contained in:
baldurk
2017-02-08 15:36:58 +00:00
parent e896233284
commit 4e14ebbe51
+35 -1
View File
@@ -755,9 +755,43 @@ Callstack::AddressDetails Win32CallstackResolver::GetAddr(DWORD64 addr)
info = GetAddrInfoForModule(modules[i].moduleId, addr);
// if we didn't get a filename, default to the module name
if(info.fileName[0] == 0)
if(modules[i].moduleId == 0 || info.fileName[0] == 0)
wcsncpy_s(info.fileName, modules[i].name.c_str(), 126);
if(modules[i].moduleId == 0 || info.funcName[0] == 0)
{
// if we didn't get a function name, at least indicate
// the module it came from, and an offset
wchar_t *baseName = info.fileName;
wchar_t *c = wcsrchr(baseName, '\\');
if(c)
baseName = c + 1;
c = wcsrchr(baseName, '/');
if(c)
baseName = c + 1;
wsprintfW(info.funcName, L"%s+0x%08I64x", baseName, addr - base);
c = wcsstr(info.funcName, L"pdb");
if(c)
{
if(i == 0)
{
c[0] = 'e';
c[1] = 'x';
c[2] = 'e';
}
else
{
c[0] = 'd';
c[1] = 'l';
c[2] = 'l';
}
}
}
break;
}
}