我可以创建在code iOS中断点,如`{__asm​​ INT 3}`在VC ++,并继续执行它被击中后? [英] Can I create a breakpoint in code in iOS, like `__asm{int 3}` on VC++, and continue execution after it's been hit?

查看:458
本文介绍了我可以创建在code iOS中断点,如`{__asm​​ INT 3}`在VC ++,并继续执行它被击中后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图把 ASM {INT 3} (或类似)到我的iPhone程序的等价物。我的目标是让X code正好停在出错的行,而不必调用堆栈乱动(让 _DEBUGGER 听起来并不像它会做,不是我能找到它的哪个框架反正...),并留下了我能够恢复执行(这就是为什么我不快乐断言)。

I'm trying to put the equivalent of asm{int 3} (or similar) into my iPhone program. My goal is to have Xcode stop exactly on the offending line, without having to fiddle with the call stack (so _Debugger doesn't sound like it would do, not that I could find which framework it's in anyway...), and leave me able to resume execution (which is why I'm not happy with assert).

(我已经习惯了在其他系统上这两种行为,我想重现他们在iOS上。)

(I'm used to both these behaviours on other systems, and I'd like to reproduce them on iOS.)

我的最好的尝试,到目前为止一直是这个:

My best attempt so far has been this:

asm volatile("bkpt 1");

这将停止有问题的行X code,但是当我试图继续用CMD + ALT + P,X code能够运行 BKPT 一次。如果我使用Shift + Cmd的+ O,我只是得到这样的:

This stops Xcode on the line in question, but when I try to continue with Cmd+Alt+P, Xcode appears to run the BKPT again. And if I use Shift+Cmd+O, I just get this:

Watchdog has expired.  Remote device was disconnected?  Debugging session terminated.

(不用说,远程设备仍连接。)

(Needless to say, the remote device IS still connected.)

我没有一个巨大的与iOS,苹果,ARM,GDB或GCC的 ASM 东西的经验量。所以,我已经难住了。有没有让iOS和X code到做我想做的某种方式?

I don't have a huge amount of experience with iOS, Mac, ARM, gdb, or gcc's asm stuff. So I'm stumped already. Is there some way of getting iOS and Xcode to do what I want?

(我不知道这是否有差别,但该指令的大小我的程序判断是ARM code)

(I don't know if it makes a difference but judging by the instruction size my program is ARM code.)

[这个问题下的另一种称谓最初出现。我已经编辑了,希望能够让事情更清晰。]

[This question appeared originally under another title. I've edited it, hopefully to make things clearer.]

推荐答案

加薪(SIGTRAP)是有一个在code断点相对可移植的方式。

raise(SIGTRAP) is a relatively portable way to have an "in code" breakpoint.

这篇关于我可以创建在code iOS中断点,如`{__asm​​ INT 3}`在VC ++,并继续执行它被击中后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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