Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com, jjohnstn@redhat.com
Subject: Re: lin-lwp and exiting threads
Date: Tue, 26 Aug 2003 18:32:00 -0000	[thread overview]
Message-ID: <20030826175418.GA25424@nevyn.them.org> (raw)
In-Reply-To: <20030826175135.GA25329@nevyn.them.org>

On Tue, Aug 26, 2003 at 01:51:35PM -0400, Daniel Jacobowitz wrote:
> Hi Jeff,
> 
> I'm doing some work in lin-lwp.c and I saw this bit you recently committed:
> 
> +      /* Check if the current LWP has previously exited.  For nptl threads,
> +         there is no exit signal issued for LWPs that are not the
> +         main thread so we should check whenever the thread is stopped.  */
> +      if (!lin_lwp_thread_alive (lp->ptid))
> +       {
> +         if (in_thread_list (lp->ptid))
> +           {
> +             /* Core GDB cannot deal with us deleting the current
> +                thread.  */
> +             if (!ptid_equal (lp->ptid, inferior_ptid))
> +               delete_thread (lp->ptid);
> +             printf_unfiltered ("[%s exited]\n",
> +                                target_pid_to_str (lp->ptid));
> +           }
> +         if (debug_lin_lwp)
> +           fprintf_unfiltered (gdb_stdlog,
> +                               "SWC: %s already exited.\n",
>                                 target_pid_to_str (lp->ptid));
> 
> 
> This is right after waitpid has returned a non-exiting stopped status for
> lp->ptid.  Were you just being thorough, or do you have some reason to
> believe that waitpid would ever return WIFSTOPPED (status) and yet the
> thread would be dead?

Also, there's:
  pid = waitpid (GET_LWP (lp->ptid), &status, 0);
  if (pid == -1 && errno == ECHILD)
    {
      pid = waitpid (GET_LWP (lp->ptid), &status, __WCLONE);
      if (pid == -1 && errno == ECHILD)
        {
          /* The thread has previously exited.  We need to delete it now
             because in the case of NPTL threads, there won't be an
             exit event unless it is the main thread.  */
          if (debug_lin_lwp)
            fprintf_unfiltered (gdb_stdlog,
                                "SWC: %s exited.\n",
                                target_pid_to_str (lp->ptid));
          delete_lwp (lp->ptid);
          return 0;
        }
    }
  
Is there some reason you don't also call delete_thread?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2003-08-26 18:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-26 17:52 Daniel Jacobowitz
2003-08-26 18:32 ` Daniel Jacobowitz [this message]
2003-08-26 19:17   ` J. Johnston
2003-08-26 18:48     ` Daniel Jacobowitz

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=20030826175418.GA25424@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jjohnstn@redhat.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