How to understand .pdb files of visual studio?
I opened it with an editor,totally messy.
BTW, in the "Disassembly" view,is it possib开发者_Python百科le to dump all the assembly code? I tried but can only grab a screen of lines
I've been keeping track of your questions. There's context that you should have put in your question, I think you're trying to debug a DirectShow plug-in that you don't have the source code for. Some kind of camera gizmo.
No, opening a .pdb file in a text editor isn't going to show you anything useful. It is binary data. I know you have a relevant .pdb for the plug-in you're working with, you get decent stack traces with named functions. You probably got the .pdb from the Microsoft Symbol server. Reading a .pdb file is the job of the debugger. There are several APIs available to read it yourself, the dbghelp API is the core one.
But it will not show you anything you don't already know from the debugger. The .pdb file is just a database of functions. You got the stripped one, it will never show more than what you see in the call stack window.
Ultimately, this is a chain of XY questions. You keep asking about Y without ever revealing what the real X problem is all about. You'll just get useless answers, like this one, until you tell us about X.
CodeProject: How to Inspect the Contents of a Program Database (PDB) File
Keep in mind though, that those files are for the debugger and not directly for you. At least I don't have the urgent wish of being able to read every possible file format in a text or hex editor.
Bearing in mind @Hans Passant's remarks - I think the question as is deserves an answer, if nothing else then for sake of those arriving here by search.
The shipped tool for PDB inspection is DBH. It is bundled with debugging tools for windows. While admittedly a command line tool (I'm from the GUI generation personally) , it is tremendously rich in features and you'd be hard pressed to find anything it can't do in half a line.
It sounds like what you want is the dumpbin
command. Note that this requires the VC tools to be in your PATH; you could either use the appropriate shortcut in the start menu or run %VSxxCOMNTOOLS%\vsvars32.bat
, where xx
is a mnemonic for the actual version of VC you are using: the easiest way to figure out exactly what environment variable to use is probably to run set
and see what variables with such names are actually set in your environment. For instance, on a system with MSVC 2005 Express and MSVC 2008 Express installed, I get this:
C:\code\xemacs-beta\nt>set | grep "VS.*COMNTOOLS" VS80COMNTOOLS=C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\ VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\
So, to create a new shell window with the VC 9 (2008) tools added to the path, I can run start "VC 9" "%VS90COMNTOOLS%\vsvars32.bat"
. (The "VC 9"
argument is the title for the new window.)
Anyway, with the VC tools in PATH, we can run such commands as dumpbin /disasm ..\src\temacs.exe > temacs.disasm
(except you probably aren't in the nt
subdirectory of an xemacs tree, so stick whatever path you want there). This will disassemble the file given, using any appropriate PDB it can find for the symbol names.
What MS calls documentation can be found in the dumpbin MSDN entry (actually, it's a lot better than I remembered it as being -- perhaps I was sore at it for being so uninformative about the /disasm
flag in particular), but don't underestimate the usefulness of dumpbin /?
-- it may not give as much information, but at least you can see it all on the screen at one time.
精彩评论