The mechanism will be the following, mainly implemented in user mode in the
LinuxThread package:
1) For each thread created, a special area is reserved in the shared memory
for a fault context to be written by the kernel.
2) All threads but the thread manager uses a special sysctl() to specify
that instead of doing a core dump, the fault context must be written
at the reserved area.
3) Under a fault, a thread context is written at its own place, and the
thread manager is signaled that a thread has died with a signal
(no core is actually dumped, but the fault context in the memory);
the thread manager then implements the POSIX behaviour by broadcasting
the signal to all threads but itself.
4) All threads receive the signal and the kernel writes their current context
in their reserved area.
5) The thread manager waits for the death of all threads, and then sends to
itself the received signal, which actually dumps the core (since the
thread manager has not required special handling of core dump).
6) GDB is actually updated to handle the context of all linuxthread not from
the multithreaded core format, but from the context area reserved
for each threads but the thread manager. Notice that even if not
modified, GDB is able to read a correct core format and to tell which
signal has been received, but is unable to give more informations.
The main advantage of this schema is that the core is not multithreaded within
its own format, but via a special format fixed by the user-level
package. The kernel does not need to know anything about the core
format for multithreaded applications (It may also work for core
formats that do not handle multithreads, like a.out). The modifications
in the kernel are very limited, since the behaviour in the signal
handling functions are preserved. Only the core-dumping mechanism
has to be modified to handle the fact that the context writing is
required instead of the core dump (plus the sysctl() handling).
Hope this will give some implementation ideas,
-Eric
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ Eric PAIRE
Web : http://www.ri.silicomp.com/~paire | Group SILICOMP - Research Institute
Email: eric.paire@ri.silicomp.com | 2, avenue de Vignate
Phone: +33 (0) 476 63 48 71 | F-38610 Gieres
Fax : +33 (0) 476 51 05 32 | FRANCE
-
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/