如何有效地调试fork()创建的进程 [英] how to efficiently debug processess created by fork()

查看:175
本文介绍了如何有效地调试fork()创建的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有任何方法可以同时调试(使用gdb)子进程和父进程。我知道用于将进程更改为子进程的命令。但这不是我要寻找的解决方案,因为此方法只能控制孩子或父母。我正在寻找孩子和父母的同时执行步骤。

I want to know whether there is any way to debug (using gdb) both child and parent processes simultaneously. I know the command used to change processes to child one. But that is not the solution I am looking for, as this method only has control of either the child or the parent. I am looking for simultaneous execution steps of both child and parent.

例如,假设孩子正在执行程序b中的第a个步骤,而父母正在执行

For instance, say the child is executing the a'th step in program b, while the parent is executing the c'th step in program d.

似乎有必要逐步完成父母和子女的处理。有没有办法做到这一点,如果可以,我该怎么做呢?

It seems that stepping through the processes of both parent and child is necessary. Is there any way to do this, and if so, how might I go about doing it?

推荐答案


我想知道是否可以同时调试(使用gdb)子进程和父进程。

I want to know whether there is any way to debug(using gdb) both child and parent processes simultaneously.

是的,<一个href = http://sourceware.org/gdb/wiki/MultiProcess rel = nofollow>有。文档此处此处。如果您使用的是Linux,则需要

Yes, there is. Documentation here and here. If you are on Linux, you'll want to

(gdb) set detach-on-fork off

这篇关于如何有效地调试fork()创建的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆