Abhinav
Abhinav

Reputation: 38162

Thread not stopping on actual line of code when crash in XCODE 4.2

I am using XCODE 4.2. Whenever I crash I do not see the actual line of code where I am crashing instead I see symbolic addresses with generic exception handler all the time in the stack trace. Do I need to do some setups to see the actual line of code crashing it.

enter image description here enter image description here

Upvotes: 1

Views: 285

Answers (3)

BJ Homer
BJ Homer

Reputation: 49034

If you look at the stack trace, you'll see handle_uncaught_exception. This means that your app is crashing because an exception was thrown and not handled. Often, this means you tried to use a deallocated object, or you tried to access something beyond the end of an array.

Of course, at this point, it's hard to tell what went wrong. Luckily, Xcode will let you set a breakpoint to stop whenever an exception is raised, which will give you far more context.

It's really easy; just choose "Add exception breakpoint" here:

Image showing the "Add exception breakpoint" option in Breakpoints Navigator

Then run your app again and you'll stop right where the error was found.

Upvotes: 2

Catfish_Man
Catfish_Man

Reputation: 41801

You should set an exception breakpoint. That backtrace just means you had an uncaught exception.

Upvotes: 1

Neil
Neil

Reputation: 2058

ThIs is normal, it happens when the compiler doesn't know the exact source that caused the program to crash. They are called run time errors. You'll get this many times to come in the future.

To solve this simply Debug the program manually. To do so, narrow down a spot where you think the source of the crash is, and add a breakpoint by clickIng on the Left hand margin beside the code.

When your program reaches that point, it will stop running and allow you to manually jump from line to line. Then you hopefully get to the point where your program crashed.

Upvotes: -1

Related Questions