首页
社区
课程
招聘
哪位DX可以告诉我调试符号是怎么工作的?
发表于: 2005-2-23 01:25 4302

哪位DX可以告诉我调试符号是怎么工作的?

2005-2-23 01:25
4302
有很多调试符号文件map,sym,nms,pdb
怎么搞得清楚啊?

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
map文件(这个你用vc编译器设置一下,产生一个map文件用记事本打开看看就知道了)


映射文件是一个文本文件,包含有关被链接程序的下列信息:

模块名称,为文件的基名称
时间戳,来自程序文件头(不是来自文件系统)
程序中的组列表,包括每个组的起始地址(节:偏移量的形式)、长度、组名和类
公共符号的列表,包括每个地址(节:偏移量的形式)、符号名称、平直地址和包含符号

定义的 .obj 文件
入口点(节:偏移量的形式)
----------------------------------------------------
pdb文件(调试程序时使用,比如vc下断点的时候可以在辅助窗口看到变量名):
链接器将调试信息放在程序数据库 (PDB) 中。它在后面的程序生成期间更新 PDB。

为调试创建的 .exe 文件或 DLL 包含相应 PDB 的名称和路径。调试器在您调试程序时

读取嵌入的名称并使用 PDB。链接器使用程序的基名称和扩展名 .pdb 命名程序数据库

,并嵌入它的创建路径。若要重写该默认值,请设置 /PDB 并指定不同的文件名。

编译器的仅限行号 (/Zd) 或 C7 兼容 (/Z7) 选项使编译器将调试信息保留在 .obj 文

件中。还可以使用程序数据库 (/Zi) 编译器选项将调试信息存储在 .obj 文件的 PDB

中。链接器首先在写入 .obj 文件的绝对路径中查找对象的 PDB,然后在包含 .obj 文

件的目录中查找。不能指定对象的 PDB 文件名或链接器的位置。

------------------------------------------------
sym(来自softice帮助):
When you load symbols for an application, SoftICE creates a
symbol table that contains all the symbols defined for that module.
 Use the TABLE command to see all the symbol tables that are loaded:
:TABLE
GDIDEMO [NM32]
964657 Bytes Of Symbol Memory Available
The currently active symbol table is listed in bold. This is the symbol
table used to resolve symbol names. If the current table is not the
Table 3-2: Classes Used by GDIDEMO Application
Class Name Handle Owner Wndw Proc Styles
• ------------------Application Private------------------
BOUNCEDEMO A018A3B0 GDIDEMO 004015A4 00000003
DRAWDEMO A018A318 GDIDEMO 00403CE4 00000003
MAZEDEMO A018A280 GDIDEMO 00403A94 00000003
XFORMDEMO A018A1E8 GDIDEMO 00403764 00000003
POLYDEMO A018A150 GDIDEMO 00402F34 00000003
GDIDEMO A018A0C0 GDIDEMO 004010B5 00000003
BETA REVIEW
26 Using SoftICE
table from which you want to reference symbols, use the TABLE
command and specify the name of the table to make active:
:TABLE GDIDEMO
 Use the SYM command to display the symbols from the current
symbol table. With the current table set to GDIDEMO, the SYM
command produces output similar to the following abbreviated
output:
:SYM
.text(001B)
001B:00401000 WinMain
001B:004010B5 WndProc
001B:004011DB CreateProc
001B:00401270 CommandProc
001B:00401496 PaintProc
001B:004014D2 DestroyProc
001B:004014EA lRandom
001B:00401530 CreateBounceWindow
001B:004015A4 BounceProc
001B:004016A6 BounceCreateProc
001B:00401787 BounceCommandProc
001B:0040179C BouncePaintProc
This list of symbol names is from the .text section of the executable. The
.text section is typically used for procedures and functions. The symbols
displayed in this example are all functions of GDIDEMO.
大致用处我猜测是用于在softice中显示加载了符号的api名字,比如GetLocalTime函数

如果没有加载相应的符号文件(也就是nms文件),程序反汇编出来的只是机器码。
----------------------------------------------------
上面一些只是我的理解,你可以参考一下softice手册。可能有错误,希望能得到高人指

点,:)
2005-2-23 14:24
0
游客
登录 | 注册 方可回帖
返回
//