Xcode 6.4 how to use exception breakpoint

60 Views Asked by At

I am fairly new to Xcode and I have a question regarding how to trace back a bad access exception.

When I run my program in Xcode 6.4, it crashes and says there is a bad access somewhere. I can look into it and see all the assembly codes. However, when I try to use exception breakpoint to trace where the bad access actually comes from in the source code, nothing happens.

I have no idea what is going on and it would be appreciated if someone can help.

1

There are 1 best solutions below

1
On

"Bad access" has nothing to do with exceptions. It's a signal, not an exception. Your program stops exactly at the point of the bad memory access. Follow the stack trace up to identify the code calling it. More importantly, use the static analyzer to show you problems, and turn on warnings to show you even more problems.

(The reason why you should set an exception breakpoint is that exceptions - not signals - end up in the debugger when it is found that nobody is catching the exception, at which point lots of evidence is destroyed. Exception breakpoint stops right when the exception is thrown, so you can follow the stack trace as well).