Xcode 4 break on exception or assert with good call stack AND printing of the exception-Collection of common programming errors
Using Xcode 4.3.2. I looked at many different similar issues including this one
no-call-stack-on-exception-in-xcode-4
but cannot get the debugger (gdb or lldb) to give me a good stack trace that shows the location of the exception AND to also prints what the exception is
Setting either a symbolic exception on objc_exception_throw
or an “All Exceptions” exception breakpoint, lldb would not give me a good stack trace but would show the following:
- thread #1: tid = 0x1c03, 0x34455238 libobjc.A.dylib
objc_exception_throw, stop reason = breakpoint 1.1 frame #0: 0x34455238 libobjc.A.dylib
objc_exception_throw frame #1: 0x323ff788 CoreFoundation`+[NSException raise:format:arguments:] + 100
That is the whole thing, either through bt
or at full magnification in the graphical breakpoint/debugger view.
If I hit continue a few time at this point it will eventually tell me the exception/assertion, for example
* Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘_endUndoGroupRemovingIfEmpty:: NSUndoManager 0x2b7610 is in invalid state, endUndoGrouping called with no matching begin
But I have no idea where it is at.
gdb, using the same breakpoint, WILL stop and show me where it is at, but does not print the exception text. If I hit continue a few times it does but I have lost my context of the back trace.
I would like to know how to print the exception text so I know WHY it stopped, without having to do a few continues and losing my place. I would also like to get it to stop in lldb at the point of the exception like it does in gdb.