commands的介绍
直接看gdb的help:commands会在关联的断点断住时被执行。
(gdb) help commands
Set commands to be executed when a breakpoint is hit.
Give breakpoint number as argument after "commands".
With no argument, the targeted breakpoint is the last one set.
The commands themselves follow starting on the next line.
Type a line containing "end" to indicate the end of them.
Give "silent" as the first line to make the breakpoint silent;
then no output is printed when it is hit, except what the commands print.
我随便写了一个commands,让读者快速瞥一眼它的大体样子。
(gdb) b main
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying ju
本文介绍了GDB中`commands`的使用,当断点被触发时,这些命令将被执行。通过示例展示了如何设置命令来显示断点处的调用栈和参数,以及如何将这些命令保存到GDB脚本文件中,方便重复使用,简化调试过程。
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



