Embedded 版 (精华区)

发信人: embeddedsys (选择·喜欢), 信区: Embedded_system
标  题: 使用WIN32环境下的gcc及GNU 7(转载)
发信站: 哈工大紫丁香 (2003年03月27日09:16:37 星期四), 站内信件

发信人: sunno (民工☆五月天高人浮躁), 信区: Embedded
标  题: 使用WIN32环境下的gcc及GNU 7(转载)
发信站: BBS 水木清华站 (Tue Jul  4 04:34:07 2000)

(转载自笑书亭)

2、使用objdump分析目标文件及可执行文件:
 
用以下命令行可查看相应目标文件及重定位信息。
● objdump -dr assem.o cprogram.o
下面为该命令行部分输出信息:
assem.o: file format pe-i386
Disassembly of section .text:
00000000 <_addition>:
0: 8b 44 24 04 mov 0x4(%esp,1),%eax
4: 89 c1 mov %eax,%ecx
6: b8 00 00 00 00 mov $0x0,%eax
0000000b <addloop>:
b: 01 c8 add %ecx,%eax
d: e2 fc loop b <addloop>
f: c3 ret
cprogram.o: file format pe-i386
// cprogram.o
Disassembly of section .text:
00000000 <.text>:
0: 70 6c jo 6e <_main+0x3e>
...
 00000030 <_main>:
 30: 55 push %ebp
 31: 89 e5 mov %esp,%ebp
 33: 83 ec 10 sub $0x10,%esp
36: e8 00 00 00 00 call 3b <_main+0xb>
37: DISP32 ___main //需重定位
3b: 68 00 00 00 00 push $0x0
3c: dir32 .text  //需重定位
40: e8 00 00 00 00 call 45 <_main+0x15>
41: DISP32 _printf //需重定位
45: 83 c4 04 add $0x4,%esp
48: 8d 45 fc lea 0xfffffffc(%ebp),%eax
4b: 50 push %eax
4c: 68 19 00 00 00 push $0x19
4d: dir32 .text  //需重定位
51: e8 00 00 00 00 call 56 <_main+0x26>
52: DISP32 _scanf  //需重定位
56: 83 c4 08 add $0x8,%esp
59: 8b 45 fc mov 0xfffffffc(%ebp),%eax
5c: 50 push %eax
5d: e8 00 00 00 00 call 62 <_main+0x32>
5e: DISP32 _addition //需重定位addition
62: 83 c4 04 add $0x4,%esp
65: 89 c0 mov %eax,%eax
67: 50 push %eax
68: 68 1c 00 00 00 push $0x1c
69: dir32 .text //需重定位
6d: e8 00 00 00 00 call 72 <_main+0x42>
6e: DISP32 _printf //需重定位
72: 83 c4 08 add $0x8,%esp
75: 89 ec mov %ebp,%esp
77: 5d pop %ebp
78: c3 ret
79: 00 00 add %al,(%eax)
...
)
...

--

--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.250.5]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.853毫秒