I have Linux system, and I writing program use Clion IDE which using CMake. I have a part my in program where I would like to debug child process I read a few topic from this forum, but I still doesn't know how or where just I can turn on this function:
gdb debugging child process after fork (follow-fork-mode child configured)
How do I debug the child process after fork() in gdb?
I just have tryed to setup flag CMAKE_CXX_FLAGS_DEBUG
as set follow-fork-mode child
but CMake give me error.
Below screenshot with all flags which are uses to compile and dbug my program.
So what and where I must set this function.
..::EDIT::..
I believe that is good way. I think Your tip was useful, but I have some next problem. After using Your instructions my code is crash on line
pid_t newProcessForClient = fork();
Statement is:
(gdb) set follow-fork-mode child [New process 31667] warning: File "/lib32/libthread_db-1.0.so" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load". warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available. [Switching to process 31667] Continuing with signal SIGABRT.
Program terminated with signal SIGABRT, Aborted. The program no longer exists.