源程序:
int main() {
int i;
for(i=0; i<10; i++) {
puts("hello world\n");
}
}
编译:
noilinux@ubuntu:~$ gcc first.c
noilinux@ubuntu:~$ ls
a.out Desktop Documents Downloads first.c Music Pictures Public Videos
运行:
noilinux@ubuntu:~$ ./a.out
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
objdump查看编辑二进制
noilinux@ubuntu:~$ objdump -D a.out|grep -A20 main.:
0804841d <main>:
804841d: 55 push %ebp
804841e: 89 e5 mov %esp,%ebp
8048420: 83 e4 f0 and $0xfffffff0,%esp
8048423: 83 ec 20 sub $0x20,%esp
8048426: c7 44 24 1c 00 00 00 movl $0x0,0x1c(%esp)
804842d: 00
804842e: eb 11 jmp 8048441 <main+0x24>
8048430: c7 04 24 e0 84 04 08 movl $0x80484e0,(%esp)
8048437: e8 b4 fe ff ff call 80482f0 <puts@plt>
804843c: 83 44 24 1c 01 addl $0x1,0x1c(%esp)
8048441: 83 7c 24 1c 09 cmpl $0x9,0x1c(%esp)
8048446: 7e e8 jle 8048430 <main+0x13>
8048448: c9 leave
8048449: c3 ret
804844a: 66 90 xchg %ax,%ax
804844c: 66 90 xchg %ax,%ax
804844e: 66 90 xchg %ax,%ax
08048450 <__libc_csu_init>:
8048450: 55 push %eb
学习代码源自 《黑客之道 漏洞发掘的艺术 第2版 》仅限交流,侵权联系删除
网友评论