Re: clone, mm->count, and coredumps

Brian Kelly (bkelly@sulaco.com)
Thu, 29 Jul 1999 09:21:11 BST


Peter Desnoyers <pjd@fred001.dynip.com> wrote:
>It strikes me that coredumps are as useful on threaded programs as on
>any other, and I wonder what would need to be done (in the kernel and
>in gdb) to get them working without application hackery.
>
>Thoughts?

A simple change is, as you suggest, change the check mm->count != 1 to
mm->count == 0. However, another problem then rears it's head if two
threads dump at the same time, the core file gets trashed. The change I've
put in to my kernel for thread core dumping adds the pid of the process to
the name of the core file (core-NNNN where NNNN is the pid padded with leading
0s if necessary) and then all my threads can dump at the same time and I
have a core file for each.

Ramakrishna@canine.wipinfo.soft.net wrote:
>Since all the threads ( processes in Linux, though cloned and sharing same
>MM ) might be running at the time of core-dump in one of the threads,
>there is most likely possibility of the MM getting changed by the time
>the dump file is written. This is so because the other processes do not
>have any knowledge of one of the threads( cloned processes ) being dumped.

True, but I have yet to encounter a threaded core dump where this has
thrown me off the scent of the real bug.

Brian

-- 
bkelly@sulaco.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/