Using dbghelp
- Magnus Therning
I was disappointed to find the Debugging Tools for Windows contains precious few code examples that helps in understanding how to use the API. Especially if one is interested in using a symbol server to get symbols. Here are my findings:
Make sure to use the correct version of
dbhelp.{dll,h}
. The ones that ship with Visual Studio or the Platform SDK aren’t the same as the one in the Debugging Tools (they lack quite a few functions).SymSetSearchPath doesn’t seem to accept the same syntax as
_NT_SYMBOL_PATH
. I gave up on using the former and resigned to having to set the latter in the environment.You want to use SymSrvGetFileIndexes to find
id
,two
andthree
that you pass to SymFindFileInPath.Microsoft’s public symbol server only offers public symbols, what this means is that your SymEnumSymbolsProc will recieve
SYMBOL_INFO
structs withTag
set toSymTagPublicSymbol
andFlags
set to 0. Not very helpful if you want to find all functions in a DLL. :-(
Added 2007-04-17 / 09:13
You also want to use the following little snippet to include dbghelp.h
:
#define __out_xcount(x)
#define _NO_CVCONST_H
#include <dbghelp.h>