How to debug a Cocoa crash
(Originally published in 2012.)
You'll need a crash report. It'll start out something like this:
Process: DragonDrop  Path: /Applications/DragonDrop.app/Contents/MacOS/DragonDrop Identifier: com.shinyplasticbag.DragonDrop Version: 1.0b1 (1.0) Code Type: X86-64 (Native) Parent Process: launchd 
In the Binary Images section, find the line with your app's bundle identifier in it. You'll need the load address (highlighted in blue) and the full path to the executable (highlighted in green).
0x10d477000 - 0x10d489fff +com.shinyplasticbag.DragonDrop (1.0b1 - 1.0) <8576B764-B97E-36B7-97B8-1F86BC53C2D9> /Applications/DragonDrop.app/Contents/MacOS/DragonDrop
Open up a Terminal and run the
atos command (this assumes you're debugging an x86_64 executable):
atos -arch x86_64 -o /Applications/DragonDrop.app/Contents/MacOS/DragonDrop -l 0x10d477000
atos will wait for you to enter addresses, one per line. The crash report will tell you which thread crashed:
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
So, scroll to that part of the crash report and find the first line that includes your bundle id.
1 com.shinyplasticbag.DragonDrop 0x000000010d47edbe 0x10d477000 + 32190
That's where your code crashed. Copy the hex addresses (highlighted in red) and paste them into your atos window:
0x000000010d47edbe 0x10d477000 -[NSApplication (NSApplication_shouldStartAtLogin) loginItemExistsWithLoginItemReference:ForPath:] (in DragonDrop) (NSApplication+startAtLogin.m:93) 0x0000000100000000 (in DragonDrop)
This tells us that our code crashed on line 93 of NSApplication+startAtLogin.m. Neat.