闯入 iPhone 上的调试器 [英] Breaking into the debugger on iPhone
问题描述
对于我的 iPhone 项目中的断言宏,我正在寻找一种以编程方式进入调试器的方法.在 Windows (MSVC++) 上,我可以为此使用 __debugbreak().调用此函数将停止我的程序,启动调试器,并显示调用 __debugbreak() 的行的调用堆栈.
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().
iPhone 有没有类似于 __debugbreak() 的东西?我试过 Debugger(),但这给了我一个链接器错误.
Is there anything similar to __debugbreak() for the iPhone? I've tried Debugger(), but that gives me a linker error.
谢谢,克劳斯
推荐答案
编辑
事实证明这也有效:
#define Debugger() { raise( SIGINT ) ;}
我认为这是相同的原则.
I think it's the same principle.
我用这个:
#define Debugger() { kill( getpid(), SIGINT ) ;}
我认为它有效在模拟器和设备上..无需组装!
I think it works in the simulator and on the device.. no assembly required!
这篇关于闯入 iPhone 上的调试器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!