How to debug a forked child process using CLion

Viewed 11994

I was debugging a Linux C program with CLion's internal debugger (which is gdb on Linux). The program forked a child process that was supposed to get suspended at the break point I set. But the debugger didn't stop there even if I had entered set follow-fork-mode child inside the gdb panel. So how can I make that happen with CLion?

4 Answers

Use the GDB tab of the debugger:

enter set follow-fork-mode child and set detach-on-fork off enter image description here

according to this link debugger: Support multi-process targets It's still not supported in Clion. set detach-on-fork off will add a thread to the frame, but you still can't control the child process. And Clion "treats exit of one of the inferiors as end of debugging session even-though others are still running".

I think there is a same issue with vscode.

Related