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

Sim*_*mon 7 xcode exception objective-c xcode4 xcode4.6

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

po $eax
Run Code Online (Sandbox Code Playgroud)

自从我升级到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
Run Code Online (Sandbox Code Playgroud)

我见过人们推荐使用这个:

register read eax
Run Code Online (Sandbox Code Playgroud)

但这给了我这个错误:

eax          = error: unavailable
Run Code Online (Sandbox Code Playgroud)

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

Seb*_*ian 26

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

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

选择objc_exception_throw堆栈帧

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