How to generate core dumps in Mac OS X?

后端 未结 4 1461
生来不讨喜
生来不讨喜 2020-11-29 01:36

It seems like I can not generate core dumps in Mac OS X 10.6.8.

$ ulimit -c unlimited
$ ./a.out 
Hello world!
Segmentation fault
$ find ~/ -type f -name core         


        
4条回答
  •  清酒与你
    2020-11-29 02:14

    You can generate core dump files on Mac Os X like this:

    1. Create the file : /etc/launchd.conf, then :

      echo "limit core unlimited" | sudo tee -a /etc/launchd.conf

    2. Restart your Mac.

    And that's it, the core dump files are generated in the /cores directory. Be careful the core dump files are large files so when you finishing troubleshooting your code, remove them.

提交回复
热议问题