如何理解Visual Studio的.pdb文件?
我用编辑器打开它,完全乱七八糟。
顺便说一句,在“反汇编”视图中,是否可以转储所有汇编代码?我尝试过,但只能抓取屏幕上的线条
I opened it with an editor,totally messy.
BTW, in the "Disassembly" view,is it possible to dump all the assembly code? I tried but can only grab a screen of lines
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我一直在跟踪你的问题。您应该在问题中添加上下文,我认为您正在尝试调试没有源代码的 DirectShow 插件。某种相机小玩意。
不,在文本编辑器中打开 .pdb 文件不会向您显示任何有用的内容。它是二进制数据。我知道您有一个与您正在使用的插件相关的 .pdb,您可以通过命名函数获得不错的堆栈跟踪。您可能从 Microsoft Symbol 服务器获得了 .pdb。读取 .pdb 文件是调试器的工作。有几个 API 可供您自己阅读,dbghelp API 是核心 API。
但它不会向您显示调试器中不知道的任何内容。 .pdb 文件只是一个函数数据库。你得到的是剥离的,它永远不会显示比你在调用堆栈窗口中看到的更多的内容。
最终,这是一系列 XY 问题。你一直在问 Y 的问题,但从未透露真正的 X 问题是什么。你只会得到无用的答案,就像这个,直到你告诉我们有关 X 的事情。
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:如何检查程序数据库 (PDB) 文件的内容
但请记住,这些文件是供调试器使用的,而不是直接供您使用的。至少我没有迫切希望能够在文本或十六进制编辑器中读取所有可能的文件格式。
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.
记住@Hans Passant 的言论 - 我认为这个问题值得一个答案,如果没有别的,那么为了那些通过搜索到达这里的人。
用于 PDB 检查的附带工具是 DBH 。它与 Windows 调试工具捆绑在一起。虽然无可否认,它是一个命令行工具(我个人来自 GUI 一代),但它的功能非常丰富,你很难找到半行它不能完成的任何事情。
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.
听起来您想要的是 dumpbin 命令。请注意,这需要 VC 工具位于您的 PATH 中;您可以使用开始菜单中的相应快捷方式或运行
%VSxxCOMNTOOLS%\vsvars32.bat
,其中xx
是您正在使用的 VC 实际版本的助记符:要准确确定要使用的环境变量,最简单的方法可能是运行 set 并查看您的环境中实际设置了哪些具有此类名称的变量。例如,在安装了 MSVC 2005 Express 和 MSVC 2008 Express 的系统上,我得到以下信息:因此,要创建一个新的 shell 窗口,并将 VC 9 (2008) 工具添加到路径中,我可以运行
start "VC 9" "%VS90COMNTOOLS%\vsvars32.bat"
。 ("VC 9"
参数是新窗口的标题。)无论如何,使用 PATH 中的 VC 工具,我们可以运行诸如
dumpbin /disasm ..\src\temacs 这样的命令.exe> temacs.disasm
(除非您可能不在 xemacs 树的nt
子目录中,所以请粘贴您想要的任何路径)。这将使用它可以找到的符号名称的任何适当的 PDB 反汇编给定的文件。MS 所谓的文档可以在 dumpbin MSDN 条目 中找到(实际上,它比我记忆中的要好得多——也许我因为对
/disasm
标志的信息如此缺乏而感到恼火),但不要低估dumpbin 的有用性/?
——它可能不会提供那么多信息,但至少您可以一次在屏幕上看到所有信息。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
, wherexx
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 runset
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: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 thent
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 ofdumpbin /?
-- it may not give as much information, but at least you can see it all on the screen at one time.