In researching debugging exceptions using LLDB, I found the following article and thread, as well as others giving the same information:
https://www.natashatherobot.com/xcode-debugging-trick/
Xcode/LLDB: How to get information about an exception that was just thrown?
When trying variations of these, the best I can get is an int as a result:
(lldb) po $rax
106377751137688
When plugging this into the Xcode memory viewer, trying it as both a base-10 and hex value, there didn't seem to be an object stored there. I get results such as B8 0B 0C 16 01 00 00 00 03...
followed by zeros as far as the eye can see. I've tried calling methods like description
on the int as if it were an address, casting it as NSException*
, which yield the result:
error: Execution was interrupted, reason: Attempted to dereference an invalid ObjC Object or send it an unrecognized selector. The process has been returned to the state before expression evaluation.
Was there a recent change to LLDB that would have broken the expected functionality? I'm using Xcode 9.2 and a mix of swift and objective-c. It might also be worth noting that I don't see the frame objc_exception_throw
in the call stack, but rather __cxa_throw
at frame 0, which is what I select to get a result.
The exception in particular I'm looking at is generated by a call to -[UIStoryboard instantiateViewControllerWithIdentifier:]
EDIT: If I manually create an NSException and @throw
it, I can view it with po $rax
. I noticed in this case, frame 0 of the call stack is objc_exception_throw
. I've edited the title to specify the type of exception I'm asking about.