February 25th, 2013, 10:45 AM
reading .pdb debug data
I am trying to read debug data from a pdb file, specifically the debug data for windows system libraries such as kernel32.dll, where the .pdb was provided by the microsoft symbol store.
I have set this environemnt variabel:
where c:\sym\ is my local symbol cache.
_NT_SYMBOL_PATH = srv*c:\sym*http://msdl.microsoft.com/download/symbols
I have fired up windbg and loaded some random file to populate the smybol cache, and i now have the public symbols for a lot of windows libraries in c:\sym\
Microsoft provides a very nice example for working wiht pdb files, to be found here: C:\Program Files\Microsoft Visual Studio 9.0\DIA SDK\Samples\DIA2Dump\
(MSVS needs to be installed....)
SO i compiled that example and tried it on itself:
And sure enough it worked and spit out quiet some info.
example.exe -all Debug\example.exe.
Next thing i tried was to load a system lib:
But that failed with this error:
example.exe -all c:\windows\system32\kernel32.dll
which stands for "PDB_NOT_FOUND" (or similar). Great.
loadDataForExe failed - HRESULT = 806D0005
So i copied kernel32.dll and kernel32.pdb from c:\sym\...\ to c:\, ran -all c:\kernel32.dll again and - poof - it worked!
Although that environemnt variable should really be enough, i tried passing my cache-path directly to the function mentioned in an above error:
But again no luck.
hr = (*ppSource)->loadDataForExe(szFilename, L"c:\\sym", &callback);
Which leaves me with the questions:
==> why wont it read the debugging data, unless it's in the same directory?
I am left feeling a little stupid for having to copy the dll + it's pdb into a temp directory, running the command, then deleting them again.
But maybe that's just what developing for MS Windows feels like.
resolved the access issue. kernel32.dll had been deleted from my %windir%. Dont ask me how, or why a direct CreateFIle() call succeeded...
Last edited by tuli; February 25th, 2013 at 12:51 PM.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.