Monday, February 11, 2013

Debugging multiple processes and following the children in Eclipse Juno

I guess Eclipse has made it much easier in recent versions of Eclipse and CDT to debug multiple processes and have the debugger follow children. It was actually easier than I had thought it would be to get this functionality in Eclipse Juno. To do so, follow these steps:

  1. Create your debug configuration, pointing to the project and program you require. 
  2. Ensure that you setup your LD_LIBRARY_PATH in your environment variables as necessary.
  3. (and here's the really important part) In the Debug Configuration, go to the 'Debugger' tab. You should see a groupbox called 'Debugger Options' containing (at least) two tabs: 'Main' and 'Shared Libraries'. On the 'Main' tab, ensure that you have 'Non-stop mode' and 'Automatically debug forked processes'. In order to get these abilities, you'll need to have both non-stop gdb and multi-process gdb
  4. As a side note, you may need to also have your debug configuration pointed to a custom gdbinit command file with the following line:
    • set follow-fork-mode child
This is admittedly a pretty high-level overview of how to get things going, but if I ever have any problems with this in the future, I'll post more details. Or if people ask me :P

No comments: