Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asm("trap") on 64-bit iOS devices

Tags:

ios

arm64

In my homegrown assert macro, I've been using asm("trap") on iOS devices (or asm("int3") on iOS simulators) to break in the debugger. However, in 64-bit builds for devices, I get an "unrecognized instruction mnemonic" for the trap instruction. Is there an equivalent for arm64?

(Alternatives like __builtin_trap() or raise(SIGINT) do work, but have some behavior I don't like; the former won't let you continue past the break, and the latter is a function so you're always one step below where you need to be in the stack when you break.)

like image 908
leremjs Avatar asked Dec 20 '13 22:12

leremjs


1 Answers

I was able to break into the debugger (and continue afterwards) with asm("svc 0");. I’m not sure this is the correct way but it seems to do the job.

like image 50
0xced Avatar answered Oct 27 '22 07:10

0xced