1 2 3 4 5 6 | #include <stdio.h> int main() { printf("Hello, world\n"); return 0; } |
1 | $ gcc hello.c |
1 2 3 4 5 6 | $ gdb -q a.out (gdb) disassemble printf Dump of assembler code for function printf: 0x8048310 <printf>: jmp *0x80495a4 0x8048316 <printf+6>: push $0x18 0x804831b <printf+11>: jmp 0x80482d0 <_init+48> |
1 2 | (gdb) x /w 0x80495a4 0x80495a4 <_GLOBAL_OFFSET_TABLE_+24>: 0x08048316 |
1 2 3 4 5 6 | $ objdump -dx a.out …… 080482d0 >.plt>: 80482d0: ff 35 90 95 04 08 pushl 0x8049590 80482d6: ff 25 94 95 04 08 jmp *0x8049594 …… |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | (gdb) b main Breakpoint 1 at 0x8048406 (gdb) r Starting program: a.out Breakpoint 1, 0x08048406 in main () (gdb) x /w 0x8049594 0x8049594 <_GLOBAL_OFFSET_TABLE_+8>: 0x4000a960 (gdb) disassemble 0x4000a960 Dump of assembler code for function _dl_runtime_resolve: 0x4000a960 <_dl_runtime_resolve>: pushl %eax 0x4000a961 <_dl_runtime_resolve+1>: pushl %ecx 0x4000a962 <_dl_runtime_resolve+2>: pushl %edx 0x4000a963 <_dl_runtime_resolve+3>: movl 0x10(%esp,1),%edx 0x4000a967 <_dl_runtime_resolve+7>: movl 0xc(%esp,1),%eax 0x4000a96b <_dl_runtime_resolve+11>: call 0x4000a740 <fixup> 0x4000a970 <_dl_runtime_resolve+16>: popl %edx 0x4000a971 <_dl_runtime_resolve+17>: popl %ecx 0x4000a972 <_dl_runtime_resolve+18>: xchgl %eax,(%esp,1) 0x4000a975 <_dl_runtime_resolve+21>: ret $0x8 0x4000a978 <_dl_runtime_resolve+24>: nop 0x4000a979 <_dl_runtime_resolve+25>: leal 0x0(%esi,1),%esi End of assembler dump. |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |