clion 产生sigabrt_如何在使用CMake的调试器中设置后续分支模式作为子模块

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:

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.

解决方案

The debugging settings have nothing to do with cmake. CMAKE_CXX_FLAGS_DEBUG states the debug flags for the compiler. However, you need to tell set follow-fork-mode child to the debugger. To do this, you need the following steps:

Set a break point at the beginning of your program (ie. the parent program, not the child program)

Start the program in the debugger.

Go to the debugger console (tab with the label gdb) in clion and enter set follow-fork-mode child and set auto-load safe-path /

Continue debugging

The command set auto-load safe-path / is supposed to switch of the auto-load restrictions according to the documentation of gdb.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值