8

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

Community
  • 1
  • 1
SRandazzo
  • 704
  • 7
  • 18
  • try setting the breakpoint to "On Catch" – Jonathan. Apr 02 '12 at 23:57
  • thanks for the suggestion, unfortunately does not work either :( I'm going to edit my question to reflect this – SRandazzo Apr 03 '12 at 15:09
  • 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-- Apr 03 '12 at 16:57
  • try adding a few more exception breakpoints: NSKVODeallocBreak, malloc_error_break, exec_bad_access. – Cliff Ribaudo Apr 15 '12 at 12:14
  • 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 Apr 17 '12 at 21:06
  • Are you using lldb or gdb to do the debugging? I'm finding that lldb is a bit unstable. – ThomasW Apr 26 '12 at 09:03
  • oh my.... switching to gdb fixed all my woes, including constant crashes every time I set a break point in xcode which was driving me insane... thank you @ThomasW ...Now how should I go about marking this question as resolved? Thanks again! – SRandazzo May 03 '12 at 17:19
  • ok. i wrote up my suggestion as an answer. – ThomasW May 04 '12 at 15:10

2 Answers2

3

Try this:

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

Type "objc_exception_throw" in symbol field and click Done.

Den Telezhkin
  • 633
  • 6
  • 9
0

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.

ThomasW
  • 16,981
  • 4
  • 79
  • 106