当前位置:   article > 正文

gdb:在命令行中会莫名暂停;detach-on-fork

detach-on-fork

这个没有捕获到断点的原因是,可能是多线程的问题,需要设置:
set detach-on-fork off

On Linux, if you want to debug both the parent and child processes, use the command:
set detach-on-fork on/off
on 默认设置,gdb会放弃子线程(或者父线程,受follow-fork-mode的控制)的监控。
off gdb会同时监控父线程及子线程。在调试一个线程的时候,另一个也会暂停。

如果您选择“detach-on-fork=off”,则 gdb 将保留对所有子线程(包括嵌套子线程)的控制。您可以使用 info inferiors 命令列出 gdb 控制下的子进程,并使用 inferior 命令从一个子线程切换到另一个子线程。
To quit debugging one of the forked processes, you can either detach from it by using the detach inferiors command (allowing it to run independently), or kill it using the kill inferiors command.
If you ask to debug a child process and a vfork is followed by an exec, gdb executes the new target up to the first breakpoint in the new target. If you have a breakpoint set on main in your original program, the breakpoint will also be set on the child process’s main.
On some

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号