From d05edca3d2e1e08dda6eb8341ab564401ebaaf2c Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 13 Oct 2016 15:57:38 +0200 Subject: [PATCH] If DIA can't find Function symbol, retry with PublicSymbol. Closes #364 * I don't see any docs on why a function wouldn't be reported as a function, but instead as a public symbol, but this seems to be the case and it fixes some problems where symbols aren't located. Oh well. --- pdblocate/pdblocate.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pdblocate/pdblocate.cpp b/pdblocate/pdblocate.cpp index 0de5b551d..a67f9bf9b 100644 --- a/pdblocate/pdblocate.cpp +++ b/pdblocate/pdblocate.cpp @@ -51,6 +51,7 @@ struct IDiaEnumDebugStreams; enum SymTagEnum { SymTagFunction = 5, + SymTagPublicSymbol = 10, }; struct IDiaSourceFile : public IUnknown @@ -529,14 +530,25 @@ AddrInfo GetAddr(wstring req) if(module > 0 && module < modules.size()) { + SymTagEnum tag = SymTagFunction; IDiaSymbol *pFunc = NULL; - HRESULT hr = modules[module].pSession->findSymbolByVA(addr, SymTagFunction, &pFunc); + HRESULT hr = modules[module].pSession->findSymbolByVA(addr, tag, &pFunc); if(hr != S_OK) { if(pFunc) pFunc->Release(); - return ret; + + // try again looking for public symbols + tag = SymTagPublicSymbol; + hr = modules[module].pSession->findSymbolByVA(addr, tag, &pFunc); + + if(hr != S_OK) + { + if(pFunc) + pFunc->Release(); + return ret; + } } DWORD opts = 0;