lldb断点命令在XCode 8中不起作用 [英] lldb breakpoint commands not working in XCode 8

查看:207
本文介绍了lldb断点命令在XCode 8中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在看来,它不仅限于frame info,实际上,breakpoint command add命令中的任何一个都不起作用.只有在(lldb)命令提示符下手动输入时,它们才会起作用

It now appears that it's not limited to frame info but in fact, NONE of the breakpoint command add commands work. They will only work if typed in manually at an (lldb) command prompt

我通过XCode控制台在LLDB中设置了一些断点,以检查类及其在代码中的用法.

I set some breakpoints in LLDB via the XCode console, to examine a class and how it's used in code.

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

断点7:73个位置.

(lldb) breakpoint command add 7

输入调试器命令.键入"DONE"结束.

Enter your debugger command(s). Type 'DONE' to end.

 frame info

 continue

 DONE

此功能在XCode 4之前的所有XCode早期版本中均能正常工作.但是,现在,我得到的只是控制台中的这些语句,并且没有框架信息. 我已经在5种不同的类上尝试了breakpoint命令,但它们却对它们都不起作用...总是此输出.

This has worked fine in all previous versions of XCode going back to XCode 4. Now however, all I get are these statements in the console, and no frame info. I have tried the breakpoint commands on 5 different classes, and it worked on none of them... always this output.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

命令2继续"继续执行目标.

Command #2 'continue' continued the target.

还请注意,仅在breakpoint command add语句内起作用

Also note that THIS ONLY FAILS TO WORK INSIDE A breakpoint command add statement

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

If I am simply stopped at a breakpoint in LLDB at the (lldb) command prompt, I can type frame info and it works as expected, however, as indicated above, adding frame info as a breakpoint command completely fails with the output above.

推荐答案

以下变通办法在Xcode 8.0中对我有效:

The following workaround worked for me in 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脚本.

More info: I could not get external python scripts going in Xcode 8.

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

link to LLDB python commands: https://lldb.llvm.org/python-reference.html

这篇关于lldb断点命令在XCode 8中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆