asm("trap") 在 64 位 iOS 设备上 [英] asm("trap") on 64-bit iOS devices

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

问题描述

在我自己开发的 assert 宏中,我一直在 iOS 设备上使用 asm("trap")(或在 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) 之类的替代方法确实有效,但有一些我不喜欢的行为;前者不会让您继续休息,而后者是一个函数,因此您总是下一个步骤,当你打破时你需要在堆栈中.)

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

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

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