I have a Linux system and am writing a program using the Clion IDE that uses CMake . I have a part of my program in which I would like to debug a child process. I read several topics from this forum, but I still donβt know how and where I can enable this function:
gdb debug child process after fork (child mode configured in standby mode)
How to debug child process after fork () in gdb?
I just tried setting the CMAKE_CXX_FLAGS_DEBUG flag as set follow-fork-mode child , but CMake give me an error. Below is a screen shot of all the flags that are used to compile and dbug my program. So, what and where should I install this function.

.. :: EDIT :: ..
I think this is a good way. I think your advice is useful, but I have the following problem. After using your instructions, my code is disabled online
pid_t newProcessForClient = fork();
Statement:
(gdb) set the child mode to the following mode [New process 31667]: File "/lib32/libthread_db-1.0.so" startup was rejected by your `auto-load safe-path 'set to" $ debugdir: $ datadir / auto-load " . warning: Could not find libthread_db corresponding to the library of the lower threads, the debug thread will not be available. [Go to Process 31667] Continued with SIGABRT.
Program terminated with SIGABRT signal, canceled. The program no longer works exists.
c ++ cmake gdb clion
Mbded
source share