Jim
Jim

Reputation: 5960

How do I debug a crash when the debugger won't crash and the crash log is lacking details?

(Draco has provided an excellent idea in the checked response below.)

This crash occurs in the program when a custom URL is handled by the app delegate, then an operation is started on another thread. Sometimes the operation finishes and I can see the results in the UI. But it is always crashing.

This only happens when running without the debugger. Here is the crash log:

0   libobjc.A.dylib                 0x37d9ff7e objc_msgSend + 22
1   CoreData                        0x3634bbd2 -[_PFManagedObjectReferenceQueue _processReferenceQueue:] + 934
2   CoreData                        0x3634efd0 _performRunLoopAction + 196
3   CoreFoundation                  0x359d2b14 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12
4   CoreFoundation                  0x359d0d50 __CFRunLoopDoObservers + 252
5   CoreFoundation                  0x359d10aa __CFRunLoopRun + 754
6   CoreFoundation                  0x3595449e CFRunLoopRunSpecific + 294
7   CoreFoundation                  0x35954366 CFRunLoopRunInMode + 98
8   GraphicsServices                0x375f0432 GSEventRunModal + 130
9   UIKit                           0x33460cce UIApplicationMain + 1074
10  myApp                           0x000e2770 main (main.m:15)
11  myApp                           0x000e2728 start + 32

It looks like its trying to respond to an event or, more specifically, a notification. If that's the case, I'm guessing that the tageted observer has been removed or the object it was added to has been deallocated.

Is there a way I can intercept notifications and have a look at what's in them? If I could, I can probably identify which observer is missing, or at least narrow it down.


Update added to address WrightsCS's point about All Exceptions breakpoint. These are both set to Break On Throw, all exceptions. (Break on catch doesn't work either.)

enter image description here

How does this work when there is no exception, no crash, while running in the debugger?

Update 2

Re-titled to provide a more general scope of searches by other users. Was: "App crashes without debugger, but not with. What does the crash log tell me?"

Upvotes: 1

Views: 1140

Answers (1)

Draco
Draco

Reputation: 1003

This doesn't answer your explicit question, but it does answer the implied question:

"How do I debug a crash when the debugger won't crash and the crash log is lacking details?"

You can look at more than just the crash logs in XCode Organizer. Take a look at the Console output in the Organizer Devices section; look at the device that had the crash and click on Console. You should be able to see the debugging output from the NSLog statements there, even if it's not running with the debugger.

You can look at this in XCode while the application is running, even if the debugger is not running.

The console shows more than your application's output, so you will have to sift through it to see your applications outputs. You will see the application name on the corresponding lines.

You can do this with code compiled for Debug, Ad-Hoc, or Release. Try it with someone else's app. (Try it with Twitter. You will see some debug logging there. Try it with Safari. You might see your other suspended apps being killed by jetsam.)

You may not be able to see the line it crashed on, but you should be able to narrow it down by judiciously inserting some debug code.

Upvotes: 3

Related Questions