From: Pedro Alves <pedro@codesourcery.com>
To: Hui Zhu <teawater@gmail.com>
Cc: Michael Snyder <msnyder@vmware.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Checkpoint: wait the defunct process when delete it
Date: Thu, 13 May 2010 11:50:00 -0000 [thread overview]
Message-ID: <201005131130.57597.pedro@codesourcery.com> (raw)
In-Reply-To: <AANLkTimbAZYnYU_v0M8BjjMdFRVIJ8oQ9d65ecrjK7ev@mail.gmail.com>
On Thursday 13 May 2010 08:58:49, Hui Zhu wrote:
> >> 2. before call "inferior_call_waitpid" to waitpid the ptid.
> >> Check if ppid is a simple thread. ppid > 1
> >> Check if ppid is the GDB. If ppid is GDB, it will auto wait the ptid.
> >
> > What do you mean, it will auto wait the ptid? AFAICS,
> >
> > (gdb) checkpoint
> > (gdb) checkpoint
> > (gdb) checkpoint
> > (gdb) checkpoint
> > (gdb) checkpoint
> > (gdb) restart 5
> > (gdb) delete checkpoint 0
> >
> > will still leave checkpoint 0 zombie?
>
> This is because the parent of checkpoint is GDB. GDB will auto wait
> the zombie, so I just leave them there let GDB hanle it.
You didn't answer the question. Please point me at where is
this "gdb auto waiting".
I actually don't understand that rationale. The `init' process
will "auto wait" the checkpoint forks as well, so why bother in
the first place then?
> + if ((!find_thread_ptid (fi->parent_ptid) && find_fork_ptid (fi->parent_ptid))
> + || (find_thread_ptid (fi->parent_ptid) && is_stopped (fi->parent_ptid)))
This requires an explaning comment in the code.
> >> +
> >> + ret = call_function_by_hand (getppid_fn, 0, NULL);
> >> + if (ret == 0)
> >> + return ppid;
> >
> > ??? can getppid really return 0 ?
>
> This 0 is not the return value of getppid.
Oh, right. :-)
> This is how function "checkpoint_command" use this function. Check it
> just for code safe. :)
> ret = call_function_by_hand (fork_fn, 0, &ret);
> do_cleanups (old_chain);
> if (!ret) /* Probably can't happen. */
> error (_("checkpoint: call_function_by_hand returned null."));
Well, the only return from call_function_by_hand does:
gdb_assert (retval);
return retval;
All other cases are handled by throwing an error. So
"definitely can't happen"; please remove the new dead code
you're adding.
BTW, you patch is not error/exception safe. You didn't consider
the case of an `error' being thrown between switching the
fork and back.
Otherwise, the patch looks good.
--
Pedro Alves
next prev parent reply other threads:[~2010-05-13 10:31 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 6:23 Hui Zhu
2010-05-10 19:31 ` Michael Snyder
2010-05-10 23:30 ` Pedro Alves
2010-05-11 21:50 ` Michael Snyder
2010-05-11 22:28 ` Michael Snyder
2010-05-12 0:02 ` Pedro Alves
2010-05-11 22:43 ` Michael Snyder
2010-05-12 0:05 ` Pedro Alves
2010-05-12 0:27 ` Michael Snyder
2010-05-12 4:19 ` Hui Zhu
2010-05-12 18:39 ` Pedro Alves
2010-05-12 18:57 ` Pedro Alves
2010-05-13 9:11 ` Hui Zhu
2010-05-13 11:50 ` Pedro Alves [this message]
2010-05-14 11:05 ` Hui Zhu
2010-05-14 14:43 ` Pedro Alves
2010-05-14 15:08 ` Hui Zhu
2010-05-14 16:19 ` Pedro Alves
2010-05-17 6:41 ` Hui Zhu
2010-05-17 10:45 ` Pedro Alves
2010-05-18 17:18 ` Hui Zhu
2010-05-14 19:29 ` Michael Snyder
2010-05-17 8:11 ` Hui Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201005131130.57597.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
--cc=teawater@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox