如何在XCode 4.6中获取异常详细信息?

时间:2013-03-01 10:29:08

标签: objective-c xcode exception xcode4 xcode4.6

我曾经从模拟器中运行的应用程序中获取异常详细信息,如下所示:

po $eax

自从我升级到XCode 4.6后,它就停止了工作;我总是得到这个错误:

error: warning: couldn't get object pointer (substituting NULL):
Couldn't find '_cmd' with appropriate type in scope
Couldn't materialize struct: Couldn't read eax (materialize)
Errored out in Execute, couldn't PrepareToExecuteJITExpression

我见过人们推荐使用它:

register read eax

但是这给了我这个错误:

eax          = error: unavailable

如何在XCode 4.6中获取异常详细信息?

3 个答案:

答案 0 :(得分:26)

如果在objc_exception_throw中断,则在调用可能抛出异常的任何库之前,所选的堆栈帧是代码中的最后一帧。此时lldb不允许您访问某些寄存器(有关可能的解释,请参阅this answer

要获取异常详细信息,您必须选择objc_exception_throw堆栈帧:

Select the objc_exception_throw stack frame

现在po $eaxpo $rax如果您在OS X 64位上运行,则在iPhone / iPad上运行po $r0,在arm64上运行po $x0)应该会为您提供异常详细信息。

答案 1 :(得分:3)

我没有任何要添加的东西,只需使用this awesome guide帮助您使用操作(脚本)设置异常断点,该操作在控制台中打印异常描述

答案 2 :(得分:-3)

转到:

Product -> Scheme -> Edit Scheme -> Run on the left -> diagnostics tab 

然后启用僵尸

相关问题