views:

316

answers:

2

I'm trying to debug a segfault on an application I'm working on (works on linux of course, so I can't use that as my fallback for debugging core dumps). Anyhow, I've set "ulimit -c unlimited" and snow leopard reports "Segmentation fault (core dumped)" but alas there is no core file to be found. Does Snow Leopard put them somewhere special or is there some other option I need to enable? Surprisingly little returned when I google this...

A: 

This is just a wild guess, but did you check /Library/Logs/DiagnosticReports/?

oefe
Looks like I _do_ have one I just don't know how to use a computer I guess. No core files in there though =(
gct
Also try ~/Library/Logs/DiagnosticReports/ for application crash reports. On OS X, the /Library tree is mirrored for each user under ~/Library. If your app runs in user space, OS X will put the crash report under ~/Library.
Barry Wark
+4  A: 

You need to configure launchd so that it actually writes out the core dumps. You can find instructions for doing so in this Apple TechNote.

Basically, you need to enable Core Dumps by adding the line:

limit core unlimited

to your /etc/launchd.conf file, creating it if necessary, and then restarting.

You can also enable the core dump for a single terminal session by calling:

ulimit -c unlimited

before you launch your command-line app.

You can find the core dumps in /cores. Be careful, as core dumps can be large and can easily fill up your drive if you don't clean out the /cores directory on a regular basis.

Rob Keniger
Aha! Exactly what I wanted! I wonder why they decided to store them there instead of in the working directory...
gct
I suspect just so it's easier to clean them out. If core dumps are enabled system-wide you could end up with a lot of large files scattered around the system if they were placed in the working directory.
Rob Keniger