gdb: breakpoint: Command Lists:执行命令

5.1.7 Breakpoint Command Lists
可以在任何断点(或者是监测点watchpoint,或者是捕获点catchpoint)生效时,执行一串命令。例如:或许想在某一点处,打印特定变量的值,或者是打开另外一个断点。
commands [range…]
… command-list …
end
end关键字,代表着命令集的结束。如果想删除断点关联的命令:type commands and follow it immediately with end。
如果commands 后面不带参数,就默认是最后一个断点,watchpoint或者catchpoint((not to the breakpoint most recently encountered). If the most recent breakpoints were set with a single command, then the commands will apply to all the breakpoints set by that command. This applies to breakpoints set by rbreak, and also applies when a single break command creates multiple breakpoints (see Section 10.2 [Ambiguous Expressions], page 110).

实例

(gdb) break main
Breakpoint 

猜你喜欢

转载自blog.csdn.net/qq_36428903/article/details/131298616