Monday, May 17, 2010

Generate core files with meta-information as part of their names

Generate core files with meta-information as part of their names

A core file is generated whenever an application encounters a segmentation fault. When working on a multi-process application, the process responsible for generating a core can be recognized using the file command.

$ file core

A better way to do the same would be to have this meta information as part of the filename of the core file. This can be done by writing into the /proc/sys/kernel/core_pattern file. The following command generates core files with process name as part of the core filename generated:

# sysctl kernel.core_pattern=core.%e

To keep the changes across power cyles add kernel.core_pattern=core.%e to the file /etc/sysctl.conf. On Slackware, this file has to be created explicitly.

Author: mwnn <mwnnlin AT gmail DOT com>

HTML generated by org-mode 6.33x in emacs 23

No comments:

Post a Comment