(gdb) run Starting program: /home/chengjiajun/note/csapp/code/hello usage:hello name [Inferior 1 (process 48755) exited normally] (gdb) run A Starting program: /home/chengjiajun/note/csapp/code/hello A Hello World A! [Inferior 1 (process 48775) exited normally] gdb hello
也可以提前设置好arg的参数
1 2 3 4 5
(gdb) set args SSR (gdb) run Starting program: /home/chengjiajun/note/csapp/code/hello SSR Hello World SSR! [Inferior 1 (process 48831) exited normally]
(gdb) b 10 if x==11 Note: breakpoint 3 also set at pc 0x1194. Breakpoint 4 at 0x1194: file hello.c, line 10. (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000001149 in add at hello.c:2 2 breakpoint keep y 0x0000000000001161 in add at hello.c:4 3 breakpoint keep y 0x0000000000001194 in main at hello.c:10 4 breakpoint keep y 0x0000000000001194 in main at hello.c:10 stop only if x==11
clear + linenum/function name/filename: function name
1 2 3 4 5 6 7 8 9 10
(gdb) clear add
(gdb) info breakpoints Deleted breakpoint 1 No breakpoints or watchpoints. (gdb) info breakpoints Num Type Disp Enb Address What 2 breakpoint keep y 0x000000000000115b in add at hello.c:3 (gdb) d 2 (gdb) info breakpoints No breakpoints or watchpoints