Multi-process GDB
This page describes the work to add multi-process and multi-executable support to GDB.
GDB 7.0 has basic support for multi-process inferior control, implemented in the remote target, but it can only be used to debug systems that share code across all inferiors.
GDB 7.1 extends that by providing support for multi-process and multi-executable debugging for linux systems (native and remote) as well. This means being able to load several programs under a single GDB session; "run" or "attach" to several processes under a single GDB session, each possibly running a different program; or following all the forks and execs of an inferior and its children tree.
GDB 7.2 adds support for multi-executable control to the machine interface (MI).
Getting the code / Helping
The original code for this effort was located in the multiprocess-20081120-branch branch in the CVS repository. It prototyped the specification posted here: specification. This is loosely based on Parallel Tools Consortium's High Performance Debugger Forum's Command Interface for Parallel Debugging (pdf file) (Old web site http://www.ptools.org/hpdf/). Note that the branch was "hacky", and substantial rewriting took place while the code was incrementally merged to mainline. The branch is closed. Discussions are held on the main GDB mailing list. Patches should be posted to the gdb-patches mailing list.
What's found on the branch, not on mainline, and probably still somewhat useful
- experimental follow-fork support added to the remote target (set follow-fork-mode/set detach-on-fork).
- Worked needed:
- needs rethinking to see if we should make it work without the multi-process extensions.
- modelling vfork-done in the protocol is missing.
- try to see if it is possible to provide a higher level abstraction.
- Support for querying the remote exec file of a given process (target_pid_to_exec_file).