On Mac OS X and in the iOS simulator (both x86), we can trap to the debugger (LLDB) using the int3
instruction in inline assembly. This is nice because it traps to a particular line of code but we can continue immediately by hitting continue in the debugger.
Is there a way to do this on iOS hardware?
An answer to an older question mentions raise(SIGINT)
which as far as I can see (from examining signal.h
) does not exist. Another answer mentions the trap
assembly instruction, which causes a build error ("Unrecognized instruction mnemonic"). Also unrecognized is the BKPT
assembly instruction mentioned in ARM documentation.
I've tried __builtin_trap()
which almost, almost does what I want, but does not allow me to continue. I keep hitting it unless I advance the instruction pointer manually using jump +1
or register write pc `$pc+8\`
, which is much less convenient than just hitting continue.
I'm building for iOS 9 for 32- and 64-bit devices using Xcode 7.3.1. Any help is appreciated!