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.
This commit is contained in:
baldurk
2014-09-07 13:22:46 +01:00
parent 0ff9cccbde
commit a88fec729d
2 changed files with 22 additions and 4 deletions
+17 -4
View File
@@ -22,6 +22,7 @@
* THE SOFTWARE.
******************************************************************************/
#define USE_DIA 1
#include <windows.h>
#include <string>
@@ -34,15 +35,21 @@
#include <assert.h>
#include <dbghelp.h>
#include <dia2.h>
#include <atlconv.h>
#include <shlobj.h>
#include <vector>
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 <dia2.h>
#include <atlconv.h>
// 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;
}
}
#else
int WINAPI wWinMain(__in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPWSTR lpCmdLine, __in int nShowCmd)
{
return 2;
}
#endif
+5
View File
@@ -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;