如何在XCode 4.6中获取异常详细信息? [英] How do I get exception details in XCode 4.6?
问题描述
我曾经从仿真器中运行的应用程序获取异常详细信息:
I used to get exception details from apps running in the simulator like so:
po $eax
自升级到XCode 4.6以来,它停止工作;我总是得到这个错误:
Ever since I upgraded to XCode 4.6 it's stopped working; I always get this error:
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
我看到有人建议使用这个:
I've seen people recommend using this:
register read eax
但是这给我这个错误:
eax = error: unavailable
如何在XCode 4.6中获取异常详细信息?
How do I get exception details in XCode 4.6?
推荐答案
如果您在 objc_exception_throw
选择的堆栈帧是您的代码中的最后一帧,然后调用可能抛出异常的任何库。在这一点上,lldb不允许您访问某些注册表(请参阅此答案以获得可能的解释。
If you break on objc_exception_throw
the stack frame selected is the last frame in your code, before calling any libraries that might have thrown the exception. At that point lldb doesn't let you access some of the registers (see this answer for a possible explanation.
要获取异常详细信息,您必须选择 objc_exception_throw
堆栈框架:
To get the exception details you have to select the objc_exception_throw
stack frame:
如果您在OS X 64位上运行,则 po $ eax
( po $ rax
iPhone / iPad上的po $ r0
,在arm64上的 po $ x0
)应该给你例外的细节。
Now po $eax
(po $rax
if you are running on OS X 64 bit, po $r0
on iPhone/iPad, po $x0
on arm64) should give you the exception details.
这篇关于如何在XCode 4.6中获取异常详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!