name1e5s@sumeru:~/csapp/attacklab-name1e5s/target1$ gdb ./ctarget GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git Copyright (C) 2018 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/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./ctarget...done. (gdb) set args -q (gdb) b getbuf Breakpoint 1 at 0x4017a8: file buf.c, line 12. (gdb) run Starting program: /home/name1e5s/csapp/attacklab-name1e5s/target1/ctarget -q Cookie: 0x59b997fa
Breakpoint 1, getbuf () at buf.c:12 12 buf.c: No such file or directory. (gdb) ni 14 in buf.c (gdb) disas Dump of assembler code for function getbuf: 0x00000000004017a8 <+0>: sub $0x28,%rsp => 0x00000000004017ac <+4>: mov %rsp,%rdi 0x00000000004017af <+7>: callq 0x401a40 <Gets> 0x00000000004017b4 <+12>: mov $0x1,%eax 0x00000000004017b9 <+17>: add $0x28,%rsp 0x00000000004017bd <+21>: retq End of assembler dump. (gdb) i r rax 0x0 0 rbx 0x55586000 1431855104 rcx 0x0 0 rdx 0x7ffff7dd18c0 140737351850176 rsi 0xc 12 rdi 0x606260 6316640 rbp 0x55685fe8 0x55685fe8 rsp 0x5561dc78 0x5561dc78 r8 0x7ffff7fed540 140737354061120 r9 0x0 0 r10 0x4032b4 4207284 r11 0x7ffff7b72f50 140737349365584 r12 0x2 2 r13 0x0 0 r14 0x0 0 r15 0x0 0 rip 0x4017ac 0x4017ac <getbuf+4> eflags 0x216 [ PF AF IF ] cs 0x33 51 ss 0x2b 43 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0 (gdb)
评论