在iPhone上打入调试器 [英] Breaking into the debugger on iPhone

查看:126
本文介绍了在iPhone上打入调试器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的iPhone项目中的断言宏,我正在寻找一种以编程方式进入调试器的方法。在Windows(MSVC ++)上,为此可以使用__debugbreak()。调用此函数将停止我的程序,启动调试器,并显示一个名为__debugbreak()的行的调用堆栈。



有没有类似于__debugbreak()的苹果手机?我尝试过Debugger(),但是这会给我一个链接器错误。



谢谢,
Claus

解决方案

编辑



结果也可以:



#define Debugger(){raise(SIGINT);我认为这是一样的原则。








我使用这个:



#define Debugger(){kill(getpid(),SIGINT); } $ / $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b

For assert macros in my iPhone project, I'm looking for a way to programmatically break into the debugger. On Windows (MSVC++), I can use __debugbreak() for this purpose. Invoking this function will stop my program, launch the debugger, and display a callstack of the line that called __debugbreak().

Is there anything similar to __debugbreak() for the iPhone? I've tried Debugger(), but that gives me a linker error.

Thanks, Claus

解决方案

edit

Turns out this also works:

#define Debugger() { raise( SIGINT ) ; }

I think it's the same principle.


I use this:

#define Debugger() { kill( getpid(), SIGINT ) ; }

I think it works in the simulator and on the device.. no assembly required!

这篇关于在iPhone上打入调试器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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