-1

What I want to do is set a symbolic breakpoint on touchesBegan:withEvent, but which then continues and stops on the next command executed in my current application target.

This way, while debugging someone elses code, I can turn on the breakpoint at idle, then when I touch a control, I will land on the applications handler.

I could probably do this if it were possible to set a conditional in the first breakpoint which is checked by the second.

BricoleurDev
  • 827
  • 9
  • 14

1 Answers1

0

I don't know how you are going to identify "the next command executed in my current application target"? But it sounds like you know how to set a breakpoint wherever that is. So you could have the touchesBegan:withEvent breakpoint's command actually set the second breakpoint. See:

(lldb) help breakpoint set

for more details on how to do this.

You can also do this sort of thing with Python breakpoint commands. All the breakpoint commands share a common module scope, so if you create a Python variable in one breakpoint's command, you can read it in the second breakpoint's Python command.

There isn't a way to add Python breakpoint commands in Xcode yet, so you'll have to do this with the lldb command-line. The lldb command:

(lldb) help breakpoint command add

will give you some details about how to do this, and this page:

http://lldb.llvm.org/python-reference.html

has some more details.

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63
  • Thanks for the advice - I hadn't considered adding the breakpoint in the first trigger case, instead I had created and disabled it and was *enabling* it by breakpoint number on the trigger (which didn't work). FWIU, when you set a symbolic breakpoint, putting your app target name in the 'Module' field will create the condition to only break on my app's code. – BricoleurDev Apr 14 '16 at 21:24
  • I didn't suggest enabling the breakpoint originally because Xcode doesn't provide a way to refer to another breakpoint, so you have to set the two breakpoints, go to the lldb console, do "break list" get the number of the target breakpoint and then go put it in your trigger command. And if you add any more breakpoints that number might no longer be right, making this a fragile approach. But if you find a case where stopping at the trigger and enabling the right breakpoint number and continuing doesn't work, please file a bug at http://bugreporter.apple.com. That should work. – Jim Ingham Apr 14 '16 at 22:46