调试DLL的发布版本(与PDB文件) [英] Debugging a release version of a DLL (with PDB file)
问题描述
如果我有一个DLL(即建于发布模式)和相应的PDB文件,是否有可能调试(步到)类/方法包含在该DLL?
If I have a DLL (that was built in release-mode) and the corresponding PDB file, is it possible to debug (step-into) classes/methods contained in that DLL?
如果是这样,什么是所需的步骤/配置(例如放在哪里PDB文件)
If so, what are the required steps/configuration (e.g. where to put the PDB file)?
编辑:
如果在同一个地方作为DLL PDB文件(以一个简单的控制台测试应用程序的bin /调试目录)。我可以看到,该DLL的加载符号(在输出窗口,并在模块窗口),但我仍然不能踏入该DLL的方法。
If have the PDB file in the same place as the DLL (in the bin/debug directory of a simple console test application). I can see that the symbols for the DLL are loaded (in the Output window and also in the Modules window), but still I cannot step into the methods of that DLL.
难道这是编译器优化的结果(如他的回答迈克尔说明)?
Could this be the result of compiler optimizations (as described by Michael in his answer)?
推荐答案
我终于找到什么导致问题调试一个建于发行配置的DLL:
I finally found what cause the problems debugging a DLL that was built in release configuration:
首先,它基本上按预期工作。这意味着,如果我有内置的版本配置一个DLL再加上相应的PDB文件,然后我可以调试包含在DLL中的类/方法。
First of all, it basically works as expected. Which means, if I have a DLL built in release-configuration plus the corresponding PDB file, then I can debug the classes/methods contained in that DLL.
当我第一次试过这个,我很遗憾试图步入其中有 DebuggerStepThroughAttribute ,例如,一个类的方法:
When I first tried this, I unfortunately tried to step into methods of a class which has the DebuggerStepThroughAttribute, e.g:
[System.Diagnostics.DebuggerStepThrough]
public class MyClass {
public void Test() { ... }
}
在这种情况下,当然是不可能的踏入从调试器的方法(如预期/意)。
In that case, it is of course not possible to step into the method from the debugger (as expected/intended).
所以,一切按预期工作。非常感谢您的回答。
So everything works as intended. Thanks a lot for your answers.
这篇关于调试DLL的发布版本(与PDB文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!