Track a zombie object in xcode - ios

I'm getting this error exc_bad_access code=1 address= xcodein my IOS app so I've tried to use the zombie tool like this :
Product->Profile->Zombies then I click on start recording (the red dot)
Also I've check the Enable Zombie Objects in
Product->Scheme->Edit scheme->Run->Diagnostics
The problem is when I'm using the zombie mode and I try to simulate the error, the error is not simulated, not detected. When I run my project in normal mode, debug, the error occurs and the app crash.
So what I've missed here ?
Note this is the first time I use the zombie tools. Thanks.
Update
Error :

The problem with NSZombie here is that it keeps objects alive instead of deallocating them, but turns them into special objects that complain as soon as you try to call a method on them.
However, if you have some code like a block that just tries to access an instance variable (without calling a method on that object), this will now succeed as the object's memory region is now still available.
If you haven't done so already, simply try running your code in the normal debugger without NSZombie as that should tell you where the crash happens in the stack trace.

Related

my app is crash in xcode, but there is no stacktrace for this exception

this is a simple game running on iphone device, it will crash in some cases.but xcode only display this message:
error: memory read failed for 0xd00000000
there is no stack in the left panel.
i found the value in register pc 0xd00000000, it looks like the base address of this process.
i have add a exception breakpoint in xcode it will not active before crash.
this is the memory usage image, i have test it on iphone x:
so i want to know, how to find the directy reason of this crash? is there any method to break the process when the register change to a special value, in this case, when the pc register change to 0xd00000000, make xcode break.
stackoverflow exception cause this crash, it make my stack memory crashed,so xcode can't get the valid stacktrace of this tread.

Crash without warning xcode

I am developing the application for over 6 month.
After everithing was developed and tested, I put app aside for 2 weeks and now when I run it it start crashing without any warning:
Even if I hit Continue Execution over 20 times still nothing in log.
I have all exceptions break point and malloc_errer_break set.
App crash when I move from screen to screen (When I open 2 screen or when I close it).
Most of the time EXC_BAD_ACCESS happens when you use an object that no longer exists.
You could check for Zombies during run-time to see if you use any of your object which doesn't exist anymore.
Let me guess - you need to change a property to strong (from weak). Name of that problematic property you will find in the console after enabling check for zombies (press ⌘⇧< then check Enable Zombie Objects in Diagnostics/Memory Management)
This a very generic error, I suggest to review your code and try again and as Anc Ainu said the reason is of using an object thats no longer exists.
I recommend to set up Exception breakpoint to get place from
which your app crashes.
To make this breakpoint enabled go to breakpoint tab, then tap on plus button and choose 'Add Exception Breakpoint'.
2. And yes, enabling NSZombies also could help
you.

Xcode 5 Instruments does not show zombies

I am unable to post images as I don't yet have 10 rep so my apologies if any of this is vague.
I'm writing an ARC application for Mac OS X and it throws an EXC_BAD_ACCESS error. In an attempt to track down the issue, I have enabled Zombie Objects under the 'Diagnostics' Tab.
I then startup Instruments (Zombies)
Finally I record and cause the app to crash and the error is generated. However, instead of getting any zombie indicators in instruments, I get an app problem report for my app that I'm profiling saying that my app 'quit unexpectedly'. No stack trace is produced for me to navigate and that problem report isn't of much use to me.
Could the EXC_BAD_ACCESS error be caused by something other than dereferencing a pointer to memory that has been released? Should I always expect to get Zombies in this case when there is an EXC_BAD_ACCESS error? If so then how can I see the zombie? What else do I need to configure to get the zombies?
Thanks
Could the EXC_BAD_ACCESS error be caused by something other than dereferencing a pointer to memory that has been released?
Yes. That error simply means that your program tried to dereference a pointer that refers to a location that your program isn't allowed to access. That could be because it points to an object that no longer exists, but it can also happen when you use a pointer without setting it to something valid in the first place, or when you incorrectly try to use a non-pointer value as a pointer.
Should I always expect to get Zombies in this case when there is an EXC_BAD_ACCESS error?
No, NSZombieEnabled only helps you find cases where you're trying to access a deallocated object. It won't help you with other cases that produce EXC_BAD_ACCESS.
You could try adding an exception breakpoint in Xcode.
Click the "Breakpoint navigator" tab in Xcode
Click the plus sign
Click "Add Exception Breakpoint"

CoreFoundation Trap error "Thread1:EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe)"

i need your help i've got this frustrating "random" error.
The app is compose of one Mapviewcontroller and a collectionview on the second controller.
Sometimes when I return to the map from the second controller the app suddenly crash with this error on the the "trap" line.
The crash report doesn't point to any of my lines of code.
EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe)
I said "random error" because the same version of the same app could be build and run smooth for days, then suddenly it stuck. The only way to regain control of the app is to delete manually from the iPad and rebuild.
For your information the app uses Coredata.
Any ideas? Some method to figure out where the error come from?
Any help is appreciated, thanks!
I had this error on line like that
NSLog(#"%#: tutorial view retain count = %ld",self.class,CFGetRetainCount(CFTypeRef(tutorialView)));
where tutorialView equals nil
Restart your iOS device - that worked for me. You can also try restarting Xcode.
I was getting the crash where I had a breakpoint set, but I had breakpoints turned off. I think that there are glitches in how Xcode handles breakpoints that can cause this issue even if there aren't issues in the code itself.

message sent to deallocated instance

I know there are MANY threads that discuss this issue and trust me, I have looked at each and every one of them but none of them solved my issue.
Anyway, in my app I am receiving a message sent to deallocated instance crash. The object address follows that message and I have tried to use instruments without any success.
What I would like to do is how do I properly debug and fix this issue with the latest Xcode (4.4.1). What I would like to know is which line the app crashed on. That way, I can just focus on that one object so I can make sure it is allocated.
Does anyone know how I can do this with the latest Xcode?
Thanks!
Enable zombie. It should tell you when your code try to send message to deallocated object instance. Problem is you are using a object after it has been released. It could be autoreleased object or object you explicitly released and using after etc. Below image is the screenshot from XCode when you do "Edit Scheme"
Setting an exception breakpoint can sometimes help to zero in on the specific line of your code that is causing a problem. This Apple doc shows you how.

Resources