【问题标题】:LLDB — evaluate and continueLLDB — 评估并继续
【发布时间】:2017-01-03 20:20:30
【问题描述】:

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>

【问题讨论】:

    标签: lldb


    【解决方案1】:

    我不完全清楚你在问什么。

    但是,如果您想将命令放在文本文件中的某个位置,该文​​件将添加设置断点并向其添加命令,您需要类似:

    > 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 调试会话。

    这依赖于一个技巧,“断点命令添加”命令对最后一个断点集进行操作,这就是我不必指定断点编号的原因。

    【讨论】:

    • 我想在特定行设置断点。断点可能会解析到一个位置,continue 将忽略一个位置的以下逻辑断点
    【解决方案2】:

    我想你是在问关于 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

    【讨论】:

    • 谢谢--auto-continue true,以避免与breakpoint command add 1 混淆,其中1&lt;breakpoint-id&gt;。根据帮助:&lt;boolean&gt; -- A Boolean value: 'true' or 'false'
    • @IsaakOsipovichDunayevsky 我遇到了command add 行的问题。当我指定一种语言时,它工作得很好。想你可能想知道! :o)
    • 您可能会在 2018 年的视频中找到有关 lldb 的帮助信息:developer.apple.com/videos/play/wwdc2018/412
    【解决方案3】:

    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

    【讨论】:

    • 我不完全清楚你在问什么。你想把一个自动继续的命令放在一个文本文件中的某个地方,它会产生断点并向它添加命令,然后这样做:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-31
    • 2012-08-11
    • 2013-02-26
    • 2021-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多