版本库代码路径:/data/workspace/myshixun/ root@evassh-1441839:~# cd /data/workspace/myshixun/step1 root@evassh-1441839:/data/workspace/myshixun/step1# ll total 40 -rw-r----- 1 root root 26406 Apr 2 13:26 bomb -rw-r----- 1 root root 101 Apr 2 13:26 main.c -rw-r----- 1 root root 49 Apr 2 13:26 makefile -rw-r----- 1 root root 155 Apr 2 13:26 test.sh root@evassh-1441839:/data/workspace/myshixun/step1# objdump -d ./bomb > bomb.s root@evassh-1441839:/data/workspace/myshixun/step1# chmod 777 bomb root@evassh-1441839:/data/workspace/myshixun/step1# gdb bomb GNU gdb (Debian 7.12-6) 7.12.0.20161007-git Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type"show copying" and "show warranty"for details. This GDB was configured as"x86_64-linux-gnu". Type"show configuration"for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. Forhelp, type"help". Type"apropos word" to searchfor commands related to "word"... Reading symbols from bomb...done. (gdb) (gdb) disas phase_1 Dump of assembler code for function phase_1: 0x0000000000400ee0 <+0>: sub $0x8,%rsp 0x0000000000400ee4 <+4>: mov$0x402400,%esi 0x0000000000400ee9 <+9>: callq 0x401338 <strings_not_equal> 0x0000000000400eee <+14>: test %eax,%eax 0x0000000000400ef0 <+16>: je 0x400ef7 <phase_1+23> 0x0000000000400ef2 <+18>: callq 0x40143a <explode_bomb> 0x0000000000400ef7 <+23>: add $0x8,%rsp 0x0000000000400efb <+27>: retq End of assembler dump. (gdb) break phase_1 Breakpoint 1 at 0x400ee0 (gdb) run Starting program: /data/workspace/myshixun/step1/bomb Welcome to my fiendish little bomb. You have 6 phases with which to blow yourself up. Have a nice day!
^C Program received signal SIGINT, Interrupt. 0x00007ffff7b15910 in __read_nocancel () at ../sysdeps/unix/syscall-template.S:84 84 ../sysdeps/unix/syscall-template.S: No such file or directory. (gdb) print 0x01 $1 = 1 (gdb) x/s 0x01 0x1: <error: Cannot access memory at address 0x1> (gdb) print 0x01 $2 = 1 (gdb) print$esi $3 = 6308896 (gdb) x/s $esi 0x604420: "\n" (gdb) print %rsp A syntaxerrorin expression, near `%rsp'. (gdb) print$rsp $4 = (void *) 0x7fffffffea48 (gdb) disas Dump of assembler code for function __read_nocancel: 0x00007ffff7b15909 <+0>: mov$0x0,%eax 0x00007ffff7b1590e <+5>: syscall => 0x00007ffff7b15910 <+7>: cmp $0xfffffffffffff001,%rax 0x00007ffff7b15916 <+13>: jae 0x7ffff7b15949 <read+73> 0x00007ffff7b15918 <+15>: retq End of assembler dump. (gdb) disas phase_1 Dump of assembler code for function phase_1: 0x0000000000400ee0 <+0>: sub $0x8,%rsp 0x0000000000400ee4 <+4>: mov$0x402400,%esi 0x0000000000400ee9 <+9>: callq 0x401338 <strings_not_equal> 0x0000000000400eee <+14>: test %eax,%eax 0x0000000000400ef0 <+16>: je 0x400ef7 <phase_1+23> 0x0000000000400ef2 <+18>: callq 0x40143a <explode_bomb> 0x0000000000400ef7 <+23>: add $0x8,%rsp 0x0000000000400efb <+27>: retq End of assembler dump. (gdb) Quit (gdb) print 0x7fffffffea48 $5 = 140737488349768 (gdb) print 0x7fffffffea40 $6 = 140737488349760 (gdb) print 0x7fffffffea56 $7 = 140737488349782 (gdb) print$esi $8 = 6308896 (gdb) print 0x402400 $9 = 4203520 (gdb) x/s $esi 0x604420: "\n" (gdb) print$eax $10 = -512 (gdb) x/s $eax 0xfffffffffffffe00: <error: Cannot access memory at address 0xfffffffffffffe00> (gdb) x/s $rsp 0x7fffffffea48: "0ڪ\367\377\177" (gdb) x/s $esi 0x604420: "\n"