How to generate core dump file in Ubuntu [duplicate]

白昼怎懂夜的黑 提交于 2019-11-27 11:49:49

Linux

Activate your coredumps by:

ulimit -c unlimited

Also, check:

$ sysctl kernel.core_pattern

to see where your dumps are created (%e will be the process name, and %t will be the system time).

You can change it in /etc/sysctl.conf and then reload by sysctl -p.

You can test it by:

sleep 10 &
killall -SIGSEGV sleep

If core dumping is successful, you will see “(core dumped)” after the segmentation fault indication.

See also:


Ubuntu

If you've Ubuntu, your dumps are created by Apport in /var/crash, however it's disabled by default.

For more details, check: Where do I find the core dump in Ubuntu?


macOS/OS X

In macOS, crash dumps are automatically created by Crash Reporter in form of backtraces. You can find these crash files by executing Console and going to 'User Diagnostic Reports' section (under 'Diagnostic and Usage Information' group) or you can locate them in ~/Library/Logs/DiagnosticReports.

The actual core files are generated in /cores.

Read more: How to generate core dumps in Mac OS X?

Check the ouput of ulimit -c, if it output 0, this is why you don't have core dumped.

Use

ulimit -c unlimited

to allow core creation (maybe replace unlimited by a real size limit to be more secure) .

Set a max core dump size with ulimit -cSIZE.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!