64位iOS设备上的asm(“陷阱”) [英] asm("trap") on 64-bit iOS devices

查看:887
本文介绍了64位iOS设备上的asm(“陷阱”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我自己开发的断言宏中,我一直在iOS设备上使用asm(陷阱)(或者在iOS模拟器上使用asm(int3)来打破调试器。但是,在64位版本的设备中,我得到了陷阱指令的无法识别的指令助记符。是否有一个等效的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?

(像__builtin_trap()或raise(SIGINT)这样的替代品确实有效,但有一些我不喜欢的行为;前者赢了' t让你继续经过休息时间,后者是一个函数,所以当你休息时,你总是需要进入堆栈的一步。)

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

推荐答案

我能够使用 asm(svc 0); 进入调试器(并在之后继续)。我不确定这是正确的方式,但它似乎可以完成这项工作。

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.

这篇关于64位iOS设备上的asm(“陷阱”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆