Debugging forks (programs with multiple process) using #GDB

“Gdb” is the debugger that I use extensively for my debugging purposes. Recently I came across a situation where I had to follow the child process and debug it. The GDB is good enough for that too🙂

Gdb has an option named “follow-fork” which can be used in different ways.

By default, even if the program gets forked, the Gdb debugs only the parent process while the child process remains unimpeded. In order to debug the child process, we need to do:

set follow-fork-mode child

I made use of this command to debug the child process…🙂

And, “show follow-fork-mode” displays the response of the current debugger to the fork call.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s