Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 4 Not Breaking On Correct Line on EXC_BAD_ACCESS

I recently had my xcode upgraded to version 4, and I have an EXC_BAD_ACCESS exception in my code, but despite setting NSZombieEnabled in the environment it's still showing the break point on the thread1, int retVal = UIApplicationMain(argc, argv, nil, nil); line.

I'm sure I had this configured in XCode 3 to stop on the line of my code that was causing the exception. Now it doesn't do that and displays no error messages in the GDB window either.

Does anyone know what I might be missing?

Thanks Ray

like image 497
Ray Price Avatar asked Apr 09 '11 14:04

Ray Price


1 Answers

EXC_BAD_ACCESS is not an exception, at least not as far as breakpoints are concerned - it means the code is trying to call a method on an object that does not exist anymore, because you released it.

The easiest way to find this in XCode4 is to run Instruments (Cmd-I), and in the dialog that pops up asking you which instrument to use, choose "Zombies". Then do whatever to cause the crash, and you will see a dialog pop up with "Zombie Messaged". Click on the little arrow and you will get a history of what created, retained, or released the object. Then you can figure out who released the object early.

like image 157
Kendall Helmstetter Gelner Avatar answered Oct 13 '22 00:10

Kendall Helmstetter Gelner