c# - pdb文件什么时候实际加载

标签 c# c++ visual-studio

在 Visual Studio 中执行“调试”构建时,它会输出一个 pdb 文件,以便您在发生异常时获得详细信息。

pdb 文件中的信息是在可执行文件运行时实际加载的还是稍后发生异常时加载的?

最佳答案

IDA 等反编译器会在分析您的可执行文件时加载符号文件,或者当您告诉它用您的可执行文件加载特定符号时,只要它与当前正在调试的可执行文件匹配即可。

调试器(如 Visual Studio 调试器)会在开始调试时立即加载 PDB 文件和符号,而不是在发生异常时加载。

The MSDN page on PDB files进一步强调这一点:

The Visual Studio debugger uses the project.PDB file created by the linker directly and embeds the absolute path to the PDB in the EXE or DLL file. If the debugger cannot find the PDB file at that location or if the path is invalid (for example, if the project was moved to another computer), the debugger searches the path containing the EXE, the Symbol Path specified in the solution's Property Pages (Common Properties folder, Debug Symbol Files page). The debugger will not load a PDB that does not match the binary being debugged.

当然,如果一个程序是在没有/debug的情况下编译的,PDB文件的路径将不会包含在生成的exe或DLL中。

关于c# - pdb文件什么时候实际加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17603466/

相关文章:

c# - 从 C# 调用 C++ DLib 导致错误分配异常

c# - 如何根据外部资源有条件地以 64 位或 32 位模式运行我的程序?

c# - Visual Studio 警告级别的含义?

c++ - 如何在Visual Studio 2019中为LLVM -clang-cl添加编译器参数?

c# - 如果存在以前的版本,如何使 msi 覆盖程序?

C# EMGU 3.1 图像拼接方法参数

c++ - 线程彼此减慢

c++ - OpenCV鱼眼校准C++输出与Python不同

c# - 如何在读取数据 block 时计算 md5

c# - xslt V1.0 - 具有递归循环的子模板返回空值