Debugging multiple processes with Eclipse CDT

For debugging a child process on Linux, gdb has the ability to step into a child process after fork and exec. This behavior can be enabled with the follow-fork-mode child statement.

Put the statement

set follow-fork-mode child

in the .gdbinit file, located in the project work directory.
Now, setting some breakpoints in the code of the child process will cause gdb to halt execution.

Btw, I’ve looked for a corresponding GUI option in the debug dialog (CDT version 4.0.3), but I found none. So it seems that creating a .gdbinit file is currently the only solution for this.

2 thoughts on “Debugging multiple processes with Eclipse CDT”

  1. Hello Dirk! I am working with Eclipse Juno and cannot find the location of the .gdbinit file. I looked in the project work directory as you indicated, but was not able to find the file. I did a search in the entire system and was able to find the file in /etc/gdb/gdbinit, added the statement, but was not able to save it. Can you please help me? I am trying to debug child processes. Thank you in advance,

    Lourdes

Leave a Reply