public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Petr Sumbera <petr.sumbera@oracle.com>, gdb@sourceware.org
Subject: Re: Solaris - procfs: couldn't find pid 32748 (kernel thread 21) in procinfo list
Date: Tue, 2 Jun 2020 18:14:24 +0100	[thread overview]
Message-ID: <7fdd8e25-ccd3-00eb-ae30-b9f8c7604fd8@redhat.com> (raw)
In-Reply-To: <405d3ffb-ea46-57cb-a023-7dece1983fb6@oracle.com>

On 6/2/20 5:30 PM, Petr Sumbera wrote:

> I have modified your change to gdb 9.2 and to correct occurrence (you have added it to second occurrence of 'exited'):
> 
> --- ../../gdb-9.2/gdb/procfs.c.orig     2020-06-02 17:10:32.057735432 +0000
> +++ ../../gdb-9.2/gdb/procfs.c  2020-06-02 18:02:45.496117117 +0000
> @@ -2207,9 +2207,10 @@
>                     if (print_thread_events)
>                       printf_unfiltered (_("[%s exited]\n"),
>                                          target_pid_to_str (retval).c_str ());
> -                   delete_thread (find_thread_ptid (retval));
> -                   status->kind = TARGET_WAITKIND_SPURIOUS;
> -                   return retval;
> +                   thread_info *thr = find_thread_ptid (retval);
> +                   if (thr)
> +                     delete_thread (thr);
> +                   goto wait_again;
>                   }
>                 else if (syscall_is_exit (pi, what))
>                   {
> 
> But this time exited message repeats forever:
> 
> [LWP    24         exited]
> [LWP    24         exited]
> [LWP    24         exited]

Sounds like the LWP is stuck with the status, or the status is
cached.  We probably need to resume the process to move it out
of the syscall, I guess.  There's this bit in the file, at
another spot we call goto wait_again:

	/* How to keep going without returning to wfi: */
	target_continue_no_signal (ptid);
	goto wait_again;

wfi == wait_for_inferior, the name of a function that used
to be pretty core in infrun.c.  Nowadays handle_inferior_event
took the role.

Try doing the same.  Like:

	delete_thread (find_thread_ptid (this, retval));
	target_continue_no_signal (ptid);
	goto wait_again;

You may need to split the delete_thread/find_thread bits, or
you may not.  I'm not sure.

The TARGET_WAITKIND_SPURIOUS handling in infrun.c also
just calls resume(GDB_SIGNAL_0), so I _think_ this will work as
well as before.  I have no idea how this was supposed to handle
the case of an LWP exiting while another one is single
stepping.  Looks like we lose the original single-stepping
request.  Maybe.  Not sure.  But doesn't look like we're
making things any worse.

Thanks,
Pedro Alves


  reply	other threads:[~2020-06-02 17:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 15:29 Petr Sumbera
2020-05-28 16:01 ` Rainer Orth
2020-06-01 12:47   ` Petr Sumbera
2020-06-01 11:39 ` Petr Sumbera
2020-06-01 19:12   ` Pedro Alves
2020-06-02  7:32     ` Petr Sumbera
2020-06-02 14:53       ` Pedro Alves
2020-06-02 16:30         ` Petr Sumbera
2020-06-02 17:14           ` Pedro Alves [this message]
2020-06-03 13:09             ` Petr Sumbera
2020-06-08  9:51               ` Petr Sumbera
2020-06-08 13:47                 ` Pedro Alves

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=7fdd8e25-ccd3-00eb-ae30-b9f8c7604fd8@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=petr.sumbera@oracle.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).