From a88fec729d7a5492f04f82e35cb16ce231432b8e Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 7 Sep 2014 13:22:46 +0100 Subject: [PATCH] Add a little USE_DIA for anyone building on VS express to disable * The DIA SDK is only available on VS pro and above, but it's only needed to be able to resolve symbols in the pdblocate helper program. So we add a little define that makes pdblocate instantly quit, and then symbol resolution just fails. --- pdblocate/pdblocate.cpp | 21 +++++++++++++++++---- renderdoc/os/win32/win32_callstack.cpp | 5 +++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/pdblocate/pdblocate.cpp b/pdblocate/pdblocate.cpp index 2591c6fc4..c9fe15a43 100644 --- a/pdblocate/pdblocate.cpp +++ b/pdblocate/pdblocate.cpp @@ -22,6 +22,7 @@ * THE SOFTWARE. ******************************************************************************/ +#define USE_DIA 1 #include #include @@ -34,15 +35,21 @@ #include #include -#include -#include - #include #include using std::vector; using std::wstring; +#if USE_DIA +// if you don't have dia2.h (only included with VS pro and above) +// set USE_DIA to 1. Everything will compile but symbol resolution +// for callstacks will not work. +// If you need this, you could always drop in a pre-compiled pdblocate +// from a normal build as this file/project changes very rarely. +#include +#include + // must match definition in callstack.h struct AddrInfo { @@ -475,4 +482,10 @@ int WINAPI wWinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, CloseHandle(pipe); return 0; -} \ No newline at end of file +} +#else +int WINAPI wWinMain(__in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPWSTR lpCmdLine, __in int nShowCmd) +{ + return 2; +} +#endif diff --git a/renderdoc/os/win32/win32_callstack.cpp b/renderdoc/os/win32/win32_callstack.cpp index 3b4ca0e73..7fbf6d11e 100644 --- a/renderdoc/os/win32/win32_callstack.cpp +++ b/renderdoc/os/win32/win32_callstack.cpp @@ -433,6 +433,8 @@ void Win32CallstackResolver::OpenPdblocateHandle() void *Win32CallstackResolver::SendRecvPipeMessage(wstring message) { + if(pdblocatePipe == NULL) return NULL; + DWORD written = 0; DWORD msgLen = (DWORD)message.length()*sizeof(wchar_t); BOOL success = WriteFile(pdblocatePipe, message.c_str(), msgLen, &written, NULL); @@ -541,6 +543,9 @@ Win32CallstackResolver::Win32CallstackResolver(char *moduleDB, size_t DBSize, ws OpenPdblocateHandle(); + if(pdblocatePipe == NULL) + return; + // loop over all our modules for(char *end = moduleDB + DBSize; moduleDB < end;