1. until
这个用于执行完循环。
在执行完循环体内的最后一条语句之后执行 until, 就会执行完循环体到后面的一个语句停下。
2. finish
执行完当前的函数。
3. tui
是一个命令行的界面,能同时把代码显示出来。
inf
4. 设置条件断点的方法:
4.1 break [location] if condition
(gdb) l 2 { 3 int i; 4 int k = 0; 5 for(i = 0; i < 10; i++) 6 { 7 k = i * i; 8 } 9 10 return 0; 11 } (gdb) break 7 if i == 5 Breakpoint 4 at 0x80483ca: file testloop.c, line 7. (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/charles/code/testloop Breakpoint 4, main () at testloop.c:7 7 k = i * i; (gdb) p i $7 = 5 (gdb)4.2 使用 condition N condition. N是一个 breakpoint number.
(gdb) l 1 int main(void) 2 { 3 int i; 4 int k = 0; 5 for(i = 0; i < 10; i++) 6 { 7 k = i * i; 8 } 9 10 return 0; (gdb) break 7 Breakpoint 1 at 0x80483ca: file testloop.c, line 7. (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x080483ca in main at testloop.c:7 (gdb) help condition Specify breakpoint number N to break only if COND is true. Usage is `condition N COND', where N is an integer and COND is an expression to be evaluated whenever breakpoint N is reached. (gdb) condition 1 i == 4 (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x080483ca in main at testloop.c:7 stop only if i == 4 (gdb) r Starting program: /home/charles/code/testloop Breakpoint 1, main () at testloop.c:7 7 k = i * i; (gdb) p i $1 = 4
5. 多线程下禁止线程切换:
set scheduler-locking on