Skip to content Skip to footer

深入理解C语言的函数调用过程

[root@maple 1]# gcc -g -o test test.s

[root@maple 1]# objdump -D test >testbin

[root@maple 1]# vi testbin

//… 省略部分不相关代码

80483c0: ff d0 call *%eax

80483c2: c9 leave

80483c3: c3 ret

080483c4 :

80483c4: 55 push %ebp

80483c5: 89 e5 mov %esp,%ebp

80483c7: 83 ec 10 sub $0x10,%esp

80483ca: 8b 45 0c mov 0xc(%ebp),%eax

80483cd: 8b 55 08 mov 0x8(%ebp),%edx

80483d0: 8d 04 02 lea (%edx,%eax,1),%eax

80483d3: 03 45 10 add 0x10(%ebp),%eax

80483d6: 89 45 fc mov %eax,-0x4(%ebp)

80483d9: 8b 45 fc mov -0x4(%ebp),%eax

80483dc: c9 leave

80483dd: c3 ret

080483de

:

80483de: 55 push %ebp

80483df: 89 e5 mov %esp,%ebp

80483e1: 83 e4 f0 and $0xfffffff0,%esp

80483e4: 83 ec 20 sub $0x20,%esp

80483e7: c7 44 24 10 0b 00 00 movl $0xb,0x10(%esp)

80483ee: 00

80483ef: c7 44 24 14 16 00 00 movl $0x16,0x14(%esp)

80483f6: 00

80483f7: c7 44 24 18 21 00 00 movl $0x21,0x18(%esp)

80483fe: 00

80483ff: 8b 44 24 18 mov 0x18(%esp),%eax

8048403: 89 44 24 08 mov %eax,0x8(%esp)

8048407: 8b 44 24 14 mov 0x14(%esp),%eax

804840b: 89 44 24 04 mov %eax,0x4(%esp)

804840f: 8b 44 24 10 mov 0x10(%esp),%eax

8048413: 89 04 24 mov %eax,(%esp)

8048416: e8 a9 ff ff ff call 80483c4

804841b: 89 44 24 1c mov %eax,0x1c(%esp)

804841f: b8 04 85 04 08 mov $0x8048504,%eax

8048424: 8b 54 24 1c mov 0x1c(%esp),%edx

8048428: 89 54 24 04 mov %edx,0x4(%esp)

804842c: 89 04 24 mov %eax,(%esp)

804842f: e8 c0 fe ff ff call 80482f4

8048434: b8 00 00 00 00 mov $0x0,%eax

8048439: c9 leave

804843a: c3 ret

804843b: 90 nop

804843c: 90 nop

//… 省略部分不相关代码

Copyright © 2088 世界杯射手榜_2014世界杯16强对阵表 - panlongs.com All Rights Reserved.
友情链接