在Visual Studio中使用Pdb文件和源代码文件进行调试 [英] Debugging with Pdb file and Source Code File in Visual Studio

查看:1012
本文介绍了在Visual Studio中使用Pdb文件和源代码文件进行调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web项目,该项目将从客户端代码发布到外部dll中的方法,该文件具有该外部dll的源代码文件和pdb文件.我想做的是使用源代码文件和pdb调试外部dll.自从开始以来,Visual Studio并没有停止说没有为模块加载任何符号.

I have a web project that posts from client-side code to a method in external dll, which I have source code file and pdb file of this external dll. What I would like to do is to debug external dll using source code file and pdb. Visual studio does not stop to say no symbols are loaded for the module since.

推荐答案

要调试dll,始终需要使用具有相同版本的符号文件.在调试自己的应用程序时,通常不必关心这一点.

To debug an dll a symbol file with the same version is allways needed. When you are debugging your own applications you usually don't have to care about this.

但是在后台发生了一些事情.在构建应用程序时,Visual stuido始终将符号文件放置在debug文件夹中,并按照Loading the symbols automatic中的说明进行加载.

But there are things happening in the background. Visual stuido allways puts the symbol files in the debug folder when you build your application and also loads them as described under Loading the symbols automatic.

(分发应用程序时,通常不希望分发这些符号,因此不会将它们复制到发布目录中,而是将构建配置更改为release.)

(When you distribute your application you usually do not want to distribute those symbols and therefore they won't be copied to the release directory you change your build configuration to release.)

加载符号手册

如果要手动加载符号,可以在Modules对话框中加载它们.

If you want to load the symbols manually you can load them with the Modules dialog.

"Debug" -> "Windows" -> "Modules".

您可以右键单击一行,然后有加载符号"选项,可让您单独选择要加载的pdb文件.

You can right click a row and there is the option "Load Symbols" which lets you sepecifiy a pdb file to load.

自动加载符号

在以下位置之一找到符号时,Visual Studio也会自动加载符号.

Visual studio also loads the symbols automaticly when they can be found in one of the following places.

  • 在DLL或可执行文件中指定的位置. (默认情况下,如果您已经在计算机上构建了DLL或可执行文件,则链接程序会将关联的.pdb文件的完整路径和文件名放在DLL或可执行文件中.调试器首先检查是否有符号文件位于DLL或可执行文件中指定的位置.这很有用,因为您始终具有在计算机上编译的代码可用的符号.)

  • The location that is specified inside the DLL or the executable file. (By default, if you have built a DLL or an executable file on your computer, the linker places the full path and file name of the associated .pdb file inside the DLL or the executable file. The debugger first checks to see if the symbol file exists in the location that is specified inside the DLL or the executable file. This is helpful, because you always have symbols available for code that you have compiled on your computer.)

.pdb文件可能与DLL或可执行文件位于同一文件夹中.

.pdb files that could be present in the same folder as the DLL or executable file.

如果您想了解有关Visual Studio如何使用符号的更多信息,可以阅读

If you want to read more about how the symbols are used with visual studio you can read this article about Understanding symbol files and Visual Studio’s symbol settings.

这篇关于在Visual Studio中使用Pdb文件和源代码文件进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆