快乐虾
http://blog.csdn.net/lights_joy/
本文适用于
Xp sp3
Vs2008
欢迎转载,但请保留作者信息
我们知道一个程序生成后会包含多个SECTION,如代码,数据等等,本文拟简单学习验证一下VS2008下生成的程序的SECTION。
使用VC的向导创建一个名为demo的console工程,修改工程属性“链接器->调试->生成映射文件”,使之生成map文件。
此时工程中只有一个简单的main函数:
int _tmain(int argc, _TCHAR* argv[]) { return 0; }
使用命令行查看此时生成的SECTION列表:
dumpbin /headers demo.exe >demo.txt
得到结果:
SECTION HEADER #1
.textbss name
10000 virtual size
1000 virtual address (00401000 to 00410FFF)
0 size of raw data
0 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
E00000A0 flags
Code
Uninitialized Data
Execute Read Write
SECTION HEADER #2
.text name
31FD virtual size
11000 virtual address (00411000 to 004141FC)
3200 size of raw data
400 file pointer to raw data (00000400 to 000035FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read
SECTION HEADER #3
.rdata name
1C29 virtual size
15000 virtual address (00415000 to 00416C28)
1E00 size of raw data
3600 file pointer to raw data (00003600 to 000053FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
Debug Directories
Time Type Size RVA Pointer
-------- ------ -------- -------- --------
4E394F09 cv 3E 00016310 4910 Format: RSDS, {41D61BD5-82E2-48E1-857F-6BB37A7A31C8}, 2, E:\projects\src\cygwin\Debug\demo.pdb
SECTION HEADER #4
.data name
59C virtual size
17000 virtual address (00417000 to 0041759B)
200 size of raw data
5400 file pointer to raw data (00005400 to 000055FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write
SECTION HEADER #5
.idata name
82E virtual size
18000 virtual address (00418000 to 0041882D)
A00 size of raw data
5600 file pointer to raw data (00005600 to 00005FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write
SECTION HEADER #6
.rsrc name
C09 virtual size
19000 virtual address (00419000 to 00419C08)
E00 size of raw data
6000 file pointer to raw data (00006000 to 00006DFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only
SECTION HEADER #7
.reloc name
448 virtual size
1A000 virtual address (0041A000 to 0041A447)
600 size of raw data
6E00 file pointer to raw data (00006E00 to 000073FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42000040 flags
Initialized Data
Discardable
Read Only
有些SECTION感觉很熟悉,另外一些则比较佰生,依次看过去。