如何使用 PDB 文件

发布于 2024-11-09 04:44:12 字数 133 浏览 0 评论 0 原文

我听说使用 PDB 文件可以帮助诊断崩溃发生的位置。
我的基本理解是你给Visual studio源文件、pdb文件和崩溃信息(来自Dr Watson?)
有人可以解释一下这一切是如何运作的/涉及什么吗? (谢谢你!)

I have heard using PDB files can help diagnose where a crash occurred.
My basic understanding is that you give Visual studio the source file, the pdb file and the crash information (from Dr Watson?)
Can someone please explain how it all works / what is involved?
(Thank you!)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

瞄了个咪的 2024-11-16 04:44:12

PDB 文件将程序集的 MSIL 映射到原始源代码行。这意味着,如果将与程序集一起编译的 PDB 放在与程序集相同的目录中,则异常堆栈跟踪将包含原始源文件中位置的名称和行。如果没有 PDB 文件,您将只能看到堆栈跟踪每个级别的类名称和方法。

PDB files map an assembly's MSIL to the original source lines. This means that if you put the PDB that was compiled with the assembly in the same directory as the assembly, your exception stack traces will have the names and lines of the positions in the original source files. Without the PDB file, you will only see the name of the class and method for each level of the stack trace.

眼波传意 2024-11-16 04:44:12

PDB 文件是在构建项目时生成的。它们包含与 Visual Studio 可以解释的构建二进制文件相关的信息。

当程序崩溃并生成崩溃报告时,Visual Studio 能够获取该报告并通过应用程序的 PDB 文件将其链接回源代码。 PDB 文件必须从生成崩溃报告的同一二进制文件构建!

随着时间的推移,我们遇到了一些问题。

  • 正在调试崩溃报告的机器需要将源代码置于与构建二进制文件的机器相同的路径上。
  • 发布版本通常会优化到无法查看对象成员变量的状态的程度。

如果有人知道如何击败前者,我将不胜感激。

PDB files are generated when you build your project. They contain information relating to the built binaries which Visual Studio can interpret.

When a program crashes and it generates a crash report, Visual Studio is able to take that report and link it back to the source code via the PDB file for the application. PDB files must be built from the same binary that generated the crash report!

There are some issues that we have encountered over time.

  • The machine that is debugging the crash report needs to have the source on the same path as the machine that built the binary.
  • Release builds often optimize to the extent where you cannot view the state of object member variables

If anyone knows how to defeat the former, I would be grateful for some input.

携君以终年 2024-11-16 04:44:12

您应该考虑设置符号服务器并将 PDB 文件索引到源代码控制系统。我最近刚刚为我们的产品经历了这个过程,效果非常好。您不必担心使 PDB 文件与二进制文件一起可用,也不必担心在调试转储文件时如何获取适当的源代码。

约翰·罗宾斯的书: http://www.amazon.com/Debugging-Microsoft-NET -2-0-Applications/dp/0735622027/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1222366012&sr=8-1

在这里查看一些用于生成小型转储的示例代码(这不必须仅限于崩溃后分析 - 您可以在代码中的任何点生成它们而不会崩溃): http://www.codeproject.com/KB/debug/postmortemdebug_standalone1.aspx

You should look into setting up a symbol server and indexing the PDB files to your source code control system. I just recently went through this process for our product and it works very well. You don't have to be concerned about making PDB files available with the binaries, nor how to get the appropriate source code when debugging dump files.

John Robbins' book: http://www.amazon.com/Debugging-Microsoft-NET-2-0-Applications/dp/0735622027/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1222366012&sr=8-1

Look here for some sample code for generating minidumps (which don't have to be restricted to post-crash analysis -- you can generate them at any point in your code without crashing): http://www.codeproject.com/KB/debug/postmortemdebug_standalone1.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文