Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode: Programmatically enable a symbolic breakpoint?

Is there a way to programmatically enable a breakpoint? Normally I'd use a breakpoint condition, but I need to use a symbolic breakpoint.

Specifically, something is changing the contentOffset of my UIScrollView between a call to scrollToIndexPath and a call to reloadData. I'd like to enable the symbolic breakpoint only after the call to scrollToIndexPath.

like image 675
bcattle Avatar asked Dec 01 '15 23:12

bcattle


1 Answers

Jim Ingham's answer works on a x86 system. For an iOS device I was able to use the method described in this answer to programmatically create a breakpoint. Inserting the line

asm("svc 0");

Causes the debugger to stop on the following instruction in XCode.

enter image description here

Interestingly if you're not connected to XCode the program continues to execute normally.

like image 118
bcattle Avatar answered Sep 22 '22 16:09

bcattle