Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: Couldn't materialize struct: Couldn't read eax

For debugging on iOS simulator, I used to be able to read out $eax register and get the error message. However, I don't know if it's the new XCode version 4.6 and iOS 6.1, I can't do that any more.

(lldb) po $eax
error: Couldn't materialize struct: Couldn't read eax (materialize)
Errored out in Execute, couldn't PrepareToExecuteJITExpression

What now? Also eax is not in the real device, what do I do?

like image 234
huggie Avatar asked Feb 05 '13 09:02

huggie


3 Answers

While trojanfoe gave a great answer, something that might help others too is that if you're attempting to print $eax as a result of an exception that is not displaying a message, be sure you're in the objc_exception_throw frame in the Debug Navigator (+6) when printing it out. Otherwise you'll get the "couldn't materialize" error above.

like image 93
mattyohe Avatar answered Nov 10 '22 18:11

mattyohe


According to this LLDB guide, you can use:

register read

To examine the general purpose registers of the current thread

like image 20
trojanfoe Avatar answered Nov 10 '22 20:11

trojanfoe


Make sure your current build scheme is on debug mode, because otherwise the compiled app will be optimised by stripping out additional information for debugging.

If you are setting your own build schemes, go to Build Settings -> Code Generation -> Optimization Level, set the value to 'None [-O0]'.

like image 34
tropicalfish Avatar answered Nov 10 '22 19:11

tropicalfish