asm(“trap”) on 64-bit iOS devices

拜拜、爱过 提交于 2019-11-29 18:00:29

问题


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.)


回答1:


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.



来源:https://stackoverflow.com/questions/20713220/asmtrap-on-64-bit-ios-devices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!