IPhone - debugging EXC_BAD_ACCESS crashes

From time to time when debugging the application, I see this error in Xcode:

Software received signal: "EXC_BAD_ACCESS".

and the debugger does not stop on the problem line. Actually the debugger just shows me the page with assembly language code and what it is.

I must have paranormal abilities to find out exactly where the problem is.

Is there a way to get Xcode to give me more nutritious error messages that can detail the problem and stop on the line of violation when such errors occur?

Thanks for any help.

+4
source share
3 answers

You can enable NSzombies see here , and I found a good way to see where the real problem is: run and debug the program with the debugger open.

Thus, when a program stops executing it more often, it shows the line that was executed when the program crashed.

+2
source

When a crash occurs, open Debugger in Xcode (Run -> Debugger). There should be from 3 to 4 such panels:

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeDebugging/art/debugger_disassembly.jpg

In the upper left pane ("stack trace"), select the topmost line that is not gray.

(Note. Sometimes the stack trace can only detect internal functions due to improper memory management running in the run loop. Try building β†’ Build and analyze to first eliminate all potential memory management errors.)

+6
source

I wrote a blog that describes how to use some compiler keys that help in finding crashes that result from freeing objects before you end with them.

http://loufranco.com/blog/files/debugging-memory-iphone.html

Building and analyzing is fine, but not as good as scan-build (on which it is based). Installation Instructions:

http://loufranco.com/blog/files/scan-build-better-than-build-analyze.html

+2
source

Source: https://habr.com/ru/post/1303363/


All Articles