0

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.dylibobjc_exception_throw, stop reason = breakpoint 1.1 frame #0: 0x34455238 libobjc.A.dylibobjc_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.

Community
  • 1
  • 1
chadbag
  • 1,837
  • 2
  • 20
  • 34
  • As discussed here http://stackoverflow.com/a/1129165/792677 you can use this http://creativeinaustria.wordpress.com/2008/10/18/crash-reporter-for-iphone-applications/ and this http://creativeinaustria.wordpress.com/2008/10/20/crash-reporter-for-iphone-applications-part-2/ I'm usually getting fully symbolicated crash report which is enough to quickly solve the problem rather than play with debuggers. – A-Live Sep 26 '12 at 21:58

1 Answers1

1

Please try updating to Xcode 4.5. You're seeing an armv7 unwinder problem where lldb doesn't know how to unwind your stack completely. The Objective-C runtime has some functions that are difficult to unwind out of (hand-written assembly) but I just did a quick test on an iOS device with Xcode 4.5 and lldb behaved correctly when I had Xcode set an Exception Breakpoint on throw.

Jason Molenda
  • 14,835
  • 1
  • 59
  • 61
  • I'll try that out. Thanks! I solved my previous code issue that had been aggravated by this problem so I will have to contrive some test cases to see how it works. Thanks! – chadbag Sep 29 '12 at 19:15
  • 1
    I've not tried Xcode 4.5 yet as I am at a critical point in a project and I don't like to mess around with my tools at such junctures. But I have not forgotten this and will revisit once the project ends. – chadbag Oct 09 '12 at 17:46