【问题标题】:lldb breakpoint commands not working in XCode 8lldb 断点命令在 XCode 8 中不起作用
【发布时间】:2017-03-28 08:15:07
【问题描述】:

编辑:现在看来,它不仅限于frame info,但事实上,breakpoint command add 命令都不起作用。它们只有在(lldb)命令提示符下手动输入时才能工作

我通过 XCode 控制台在 LLDB 中设置了一些断点,以检查一个类以及它在代码中的使用方式。

(lldb) breakpoint set --func-regex "DVLayer"

断点 7:73 个位置。

(lldb) breakpoint command add 7

输入您的调试器命令。输入“DONE”结束。

 frame info

 continue

 DONE

这在 XCode 4 的所有以前版本的 XCode 中都运行良好。但是,现在我得到的只是控制台中的这些语句,没有帧信息。 我已经在 5 个不同的类上尝试了断点命令,但它对它们都不起作用……总是这个输出。

命令 #2 'continue' 继续目标。

命令 #2 'continue' 继续目标。

命令 #2 'continue' 继续目标。

命令 #2 'continue' 继续目标。

命令 #2 'continue' 继续目标。

命令 #2 'continue' 继续目标。

命令 #2 'continue' 继续目标。

命令 #2 'continue' 继续目标。

命令 #2 'continue' 继续目标。

另请注意,这仅在 breakpoint command add 语句中不起作用

如果我只是在 (lldb) 命令提示符下的 LLDB 中的断点处停止,我可以键入 frame info 并且它按预期工作,但是,如上所述,添加 frame info 作为断点命令完全失败上面的输出。

【问题讨论】:

    标签: ios xcode lldb


    【解决方案1】:

    以下解决方法在 Xcode 8.0 中对我有用:

    (lldb) breakpoint set --func-regex "setTitle"
    Breakpoint 2: 296 locations.
    (lldb) breakpoint command add --script-type python 2
    Enter your Python command(s). Type 'DONE' to end.
    def function (frame, bp_loc, internal_dict):
        """frame: the lldb.SBFrame for the location at which you stopped
           bp_loc: an lldb.SBBreakpointLocation for the breakpoint location information
           internal_dict: an LLDB support object not to be used"""
        print str(frame)
        frame.GetThread().GetProcess().Continue()
        DONE
    (lldb) 
    frame #0: 0x00000001879ca4b8 UIKit`-[UIButton _setTitleShadowOffset:]
    frame #0: 0x00000001879ca4b8 UIKit`-[UIButton _setTitleShadowOffset:]
    frame #0: 0x00000001879ca4b8 UIKit`-[UIButton _setTitleShadowOffset:]
    frame #0: 0x000000018781ef68 UIKit`-[UIButton setTitleColor:forState:]
    frame #0: 0x000000018781efb4 UIKit`-[UIButtonContent setTitleColor:]
    frame #0: 0x000000018781ef68 UIKit`-[UIButton setTitleColor:forState:]
    frame #0: 0x000000018781efb4 UIKit`-[UIButtonContent setTitleColor:]
    frame #0: 0x000000018781ef68 UIKit`-[UIButton setTitleColor:forState:]
    frame #0: 0x000000018781efb4 UIKit`-[UIButtonContent setTitleColor:]
    frame #0: 0x000000018781edec UIKit`-[UIButton setTitle:forState:]
    frame #0: 0x000000018781ee6c UIKit`-[UIButtonContent setTitle:]
    

    编辑:更多信息:我无法在 Xcode 8 中获取外部 python 脚本。

    编辑:链接到 LLDB python 命令:https://lldb.llvm.org/python-reference.html

    【讨论】:

    • 对不起,我没有早点注意到你的回答。现在才看到。这周我会试一试,如果成功的话,我会给你信用(标记为已回答)。谢谢你的例子。
    • 你有机会测试吗?
    • 哈,对不起,迈克,我还没有,但它在我的 ToDo 上。我确实在 24/7 的 chrome 窗口中打开了这个页面,只是为了记住它。现在真的很忙这个项目,但我可能会在这个周末试一试。感谢您入住。
    • 仍然没有忘记你,迈克。发誓我会尽快完成它。截止日期你知道......呃。
    • 别担心 :) 祝你在截止日期前好运。
    猜你喜欢
    • 2016-11-13
    • 2017-02-16
    • 2016-10-20
    • 1970-01-01
    • 2012-11-16
    • 2018-01-09
    • 1970-01-01
    • 2017-09-21
    • 1970-01-01
    相关资源
    最近更新 更多