Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I used to get exception details from apps running in the simulator like so:

po $eax

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

But that gives me this error:

eax          = error: unavailable

How do I get exception details in XCode 4.6?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
741 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.

To get the exception details you have to select the objc_exception_throw stack frame:

Select the objc_exception_throw stack frame

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...