This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Why aren't inferiors deleted on exit or detach
- From: Yao Qi <yao at codesourcery dot com>
- To: "Breazeal, Don" <donb at codesourcery dot com>, "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Wed, 7 May 2014 13:44:33 +0800
- Subject: Re: Why aren't inferiors deleted on exit or detach
- Authentication-results: sourceware.org; auth=none
- References: <53694328 dot 30907 at codesourcery dot com>
On 05/07/2014 04:16 AM, Breazeal, Don wrote:
> I've been struggling with the issue of when to delete inferiors, as I'm
> working on remote follow-fork. It looks like inferiors are kept around
> after a process exits or is detached or killed so that the user can
> switch to the inferior and run it again. The argument vector for the
> inferior is kept intact on exit/detach/etc.
>
> Is my understanding here correct?
Yes, I think so.
https://sourceware.org/gdb/onlinedocs/gdb/Inferiors-and-Programs.html
mentions that "Inferiors may be created before a process runs, and may
be retained after a process exits." and "After the successful completion
of a command such as detach, detach inferiors, kill or kill inferiors,
or after a normal process exit, the inferior is still valid and listed
with info inferiors, ready to be restarted."
>
> With "follow-fork parent" and "detach-on-fork on", GDB does *not* keep
> an inferior around for the detached child. My guess is that this is
> because the child inferior would just be a duplicate of the parent inferior.
>
> Correct?
I am not the people write this part of code, but afaik, GDB doesn't add
inferior into its table in this case, because these two options setting
mean after a fork, the original process is debugged and child process
will be detached, so GDB doesn't have to save child process in its
inferior table.
--
Yao (éå)