日期:2014-05-18  浏览次数:20966 次

C# 调试 符号信息---出自C#入门经典2010
看书时有句话不明白,在P136页中文版。第7章第一节调试
英文原版内容:
When you build an application in debug configuration and execute it in debug mode, more is going on
than the execution of your code. Debug builds maintain symbolic information about your application,
so that the IDE knows exactly what is happening as each line of code is executed. Symbolic information
means keeping track of, for example, the names of variables used in uncompiled code, so they can be
matched to the values in the compiled machine code application, which won’t contain such humanreadable
information. This information is contained in .pdb files, which you may have seen in your
computer’s Debug directories. This enables you to perform many useful operations:

不理解下面这句话:

.......符号信息意味着跟踪(例如)未编译代码中使用的变量名,这样,它们就可以匹配已编译的机器码应用程序中现有的值,而机器码程序不包含人们易于读取的信息。......

疑问如下:
中文版翻译它们是指变量名,还是指符号信息或其他?
现有的值是变量中存储的值还是变量的地址?

我理解的这句话的意思是:在调试模式下,编译前程序中的变量,在编译后可以通过符号信息追踪到。可是我又不太确定。请高手指教。

------解决方案--------------------
1它们是指符号信息
2现有的值是变量中存储的值
------解决方案--------------------
这样解释吧,在你能够看见的代码上加断点,但机器执行时,执行的是已经编译的二进制代码,这二者是有mapping信息的,通过你加的断点,在运行时获取变量的值。
debug信息一般在对应的.pdb文件中。

This information is contained in .pdb files