我正在尝试在 LLDB 中调试并发程序,并且出现段错误,但不是在每次执行时。我想一遍又一遍地运行我的过程,直到它遇到段错误。到目前为止,我有以下几点:
b exit
breakpoint com add 1
Enter your debugger command(s). Type 'DONE' to end.
> run
> DONE
Run Code Online (Sandbox Code Playgroud)
我觉得烦人的部分是,当我到达退出函数并命中我的断点时,当run命令被执行时,我从 LLDB 收到以下提示:
There is a running process, kill it and restart?: [Y/n]
Run Code Online (Sandbox Code Playgroud)
我想自动重启进程,不用Y每次都手动输入。有人知道怎么做吗?
您可以手动终止前一个实例kill- 这不会提示 - 然后该run命令也不会提示。
或者:
(lldb) settings set auto-confirm 1
Run Code Online (Sandbox Code Playgroud)
将为所有 lldb 查询提供默认(大写)答案。
或者,如果您有 Xcode 6.x(或当前的 TOT svn lldb),您可以使用 lldb 驱动程序的批处理模式:
$ lldb --help
...
-b
--batch
Tells the debugger to running the commands from -s, -S, -o & -O,
and then quit. However if any run command stopped due to a signal
or crash, the debugger will return to the interactive prompt at the
place of the crash.
Run Code Online (Sandbox Code Playgroud)
例如,您可以在 shell 中编写脚本,运行:
lldb -b -o 运行
在一个循环中,如果运行以崩溃而不是正常退出结束,这将停止。在某些情况下,这可能更容易做到。