Tired of looking for core files in your whole $HOME (because apps do chdir, and cores are by default in $PWD)?
mkdir /cores; chmod go+w /cores; echo « /cores/%e.%p.core » > /proc/sys/kernel/core_pattern
And voilà, you’ll find your cores easily in /cores. Much easier than find ~ -mtime 0 -name ‘core*’ !
Wow Colin, you rock!! Awesome tip, thank you.
Linux also supports passing a command to pipe the core to as the core_pattern. Quite useful in many situation (think embedded systems) where you can compress the core dump and attach other useful information (as apport is doing).
// Simon
That sounds interesting too, could you do an example of that please? Thanks!
You just echo something like
echo « |/path/to/my/script » > /proc/…/core_pattern
The apport sources serve as a good reference to what you can do. They read the header of the ELF file to get process ID and some other stuff (if I remember correctly :-)), and then collect interesting infromation from /proc etc. So you can get more information about the crash than *just* the core file.
In the Apport case, you can also get a popup on the desktop which allows you to send the crash to your distribution provider. Anyway, I think the pipe-in-core-pattern is a very useful addition and allows all sorts of interesting things to be done when core dumps are created.
// Simon
That’s very interesting… I guess I know what I’ll be reading through this weekend :-)
Thanks!
Thanks for the additional information, Simon :-)