Reputation: 3192
EDIT: 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
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"
Breakpoint 7: 73 locations.
(lldb) breakpoint command add 7
Enter your debugger command(s). Type 'DONE' to end.
frame info
continue
DONE
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.
Command #2 'continue' continued the target.
Command #2 'continue' continued the target.
Command #2 'continue' continued the target.
Command #2 'continue' continued the target.
Command #2 'continue' continued the target.
Command #2 'continue' continued the target.
Command #2 'continue' continued the target.
Command #2 'continue' continued the target.
Command #2 'continue' continued the target.
Also note that THIS ONLY FAILS TO WORK INSIDE A breakpoint command add
statement
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.
Upvotes: 5
Views: 702
Reputation: 3905
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:]
EDIT: More info: I could not get external python scripts going in Xcode 8.
EDIT: link to LLDB python commands: https://lldb.llvm.org/python-reference.html
Upvotes: 0