LLDB — 评估并继续

LLDB — evaluate and continue

XCode有设置断点的功能,然后运行lldb命令和“求值后自动继续”.

如何通过 --source 设置相同的功能?在手册中找到 --command 引用,但在子命令帮助

中没有示例和参考

By default, the breakpoint command add command takes lldb command line commands. You can also specify this explicitly by passing the "--command" option.

Syntax: command <sub-command> [<sub-command-options>] <breakpoint-id>

help breakpoint command add显示它叫--one-liner--command一定是打错了吗?

-o <one-line-command> ( --one-liner <one-line-command> )
     Specify a one-line breakpoint command inline.

问题很实际,如何在使用 --source 时自动 continue

我不是很清楚你在问什么。

但是如果你想把命令放在一个文本文件的某个地方,这将添加一个断点并向它添加命令,你需要这样的东西:

> cat /tmp/cmds.lldb
break set -F main
break command add
frame var
continue
DONE
> lldb -s /tmp/cmds.lldb myBinary

或者如果您想在 Xcode 中执行此操作,只需使用:

(lldb) command source /tmp/cmds.lldb

进入 Xcode 调试会话后。

这依赖于一个技巧,"breakpoint command add"命令在最后一个断点集上运行,这就是为什么我不必指定断点号。

我想你问的是关于 lldb 的自动继续?

我使用 modify 命令添加自动继续..

(lldb) b CCCryptorCreate
Breakpoint 1: where = libcommonCrypto.dylib`CCCryptorCreate, address = 0x000000011047e1b7

(lldb) breakpoint modify --auto-continue true 1
(lldb) br list
Current breakpoints:
1: name = 'CCCryptorCreate', locations = 1, resolved = 1, hit count = 0 Options: enabled auto-continue 
  1.1: where = libcommonCrypto.dylib`CCCryptorCreate, address = 0x000000011047e1b7, resolved, hit count = 0 

然后添加一些我用过的命令..

(lldb) breakpoint command add -s python 1
Enter your Python command(s). Type 'DONE' to end.
    print "Hit this breakpoint!"
    DONE

帮助中有一些很好的例子(lldb) help breakpoint command add