Multi Process Debugging

It bugs me to debug multiprocess C programs by using GDB. Here is a note for multi processing, and multithreaded debugging.

gdb a.out

Multi processes:

Then:

set follow-fork-mode child
set schedule-multiple on
set detach-on-fork off
b ##
r

## means a number, in this case, line number.

Switching between processes:

info inferiors
inferior #

In this case, # means process number.

Multi Threads:

info threads
thread #

Please consult the official docs for more features.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.