From 4e14ebbe512a3c8e4963ba97a2521e2c2422f1a7 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 8 Feb 2017 15:36:58 +0000 Subject: [PATCH] Improve callstack values for cases of missing symbols --- renderdoc/os/win32/win32_callstack.cpp | 36 +++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/renderdoc/os/win32/win32_callstack.cpp b/renderdoc/os/win32/win32_callstack.cpp index 1326e75d5..d0faf8c4a 100644 --- a/renderdoc/os/win32/win32_callstack.cpp +++ b/renderdoc/os/win32/win32_callstack.cpp @@ -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; } }