8
votes

Having Followed these threads:
- Xcode always stopping at main.m after a crash - Xcode 4.2 showing the wrong line of code on error - Debugging app crashes with iOS Simulator & XCode 4 halts in main() function, not crash source

I am still crashing at 'main' as opposed to the actual line of the crash.

  • Oddly Works on iOS 4.3 simulator!
  • Does not work on iOS 5.1 simulator, or the iOS 5.0 simulator
  • I have the exception breakpoint setup and active. (Exception: All, Break: On Throw. Also have tried Break: On Catch)
  • Using Apple LLVM 3.1 compiler
  • Base SDK 5.1
  • Deploy target set to 4.0
  • Configuration is set to debug
  • Project is ARC enabled
  • XCode 4.3

Thanks

2
try setting the breakpoint to "On Catch" - Jonathan.
thanks for the suggestion, unfortunately does not work either :( I'm going to edit my question to reflect this - SRandazzo
I remember that behaviour from another project, and most of the time it were uninitialized objects or use of obj = value; instead of self.obj = value;. iOS 4 simulator silently ignores those, iOS 5 is more picky it seems. Step thru the code with the debugger or use NSLog() to find out how far you get. - ott--
try adding a few more exception breakpoints: NSKVODeallocBreak, malloc_error_break, exec_bad_access. - Cliff Ribaudo
Thanks for all the suggestions, have tried them all and given it some time but still no luck. The Debugger spits out correct message: " *** First throw call stack: (0x223d022...) terminate called throwing an exception(lldb)" The crash still points to main. I am purposely causing a crash where I set up an array and try to get an object at an index beyond it's bounds. Even this crash points to main. - SRandazzo

2 Answers

3
votes

Try this:

Breakpoints -> Add -> Add symbolic breakpoint. A new window pops up.

Type "objc_exception_throw" in symbol field and click Done.

0
votes

Unfortunately lldb is somewhat unstable and appears to be the cause of the crashes in your case. Switching to gdb can cause these crashes to go away.