Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac Catalina corefile locations

I have a program that is segfaulting under Mac Catalina, but the core file is not showing up in /cores. I checked to ensure that core file size is unlimited and that core files were enabled by both creating an /etc/launchd.conf file (with "limit core unlimited" in it) and executing "launchctl". None of those has had any effect.

Anyone know how to re-enable core files under Catalina, and/or where they are being stored?

like image 432
ralph Avatar asked Nov 13 '19 19:11

ralph


2 Answers

I recently upgraded to macOS Catalina and was perplexed that I was no longer getting core dumps despite sysctl -a reporting the expected kern.corefile: /cores/core.%P and kern.coredump: 1. And having run ulimit -c unlimited in my interactive shell. I eventually traced the problem to the /cores directory having permissions rwxr-xr-x. Once I did sudo chmod 1777 /cores I was able to create core dumps as a non-root user.

like image 138
Kurtis Rader Avatar answered Nov 09 '22 14:11

Kurtis Rader


It seems that files in /bin/ are not allowed to throw cores. if you invoke sleep 50000& to kill -11 %1 this will not generate a coredump.

If you copy the program to /tmp/ beforehand, it will.

So the usefull trick to kill sleep with SIG11 to validate corefile generation won't work easily.

It also seems that killing backgrounded processes in the same shell doesn't produce coredumps in all cases.

like image 31
dothebart Avatar answered Nov 09 '22 14:11

dothebart