Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org,  Pedro Alves <palves@redhat.com>
Subject: Re: [PATCHv3 2/2] gdb/remote: Restore support for 'S' stop reply packet
Date: Mon, 09 Mar 2020 11:35:52 -0600	[thread overview]
Message-ID: <87d09lwhvr.fsf@tromey.com> (raw)
In-Reply-To: <f8df2b2e16a5f95a13a760fecb9d04cb641ddd22.1583149853.git.andrew.burgess@embecosm.com> (Andrew Burgess's message of "Mon, 2 Mar 2020 11:54:10 +0000")

Andrew> There was a regression in GDB's support for older aspects of the
Andrew> remote protocol.  Specifically, when a target sends the 'S' stop reply
Andrew> packet (which doesn't include a thread-id) then GDB has to figure out
Andrew> which thread actually stopped.

With this patch, I started seeing this warning when running the AdaCore
internal test suite using qemu.

I investigated a little and the warning comes from this packet:

    Packet received: W00
    warning: multi-threaded target stopped without sending a thread-id, using first non-exited thread

It seems to me that the warning must not be correct in this case, though
I am not 100% sure, so I thought I would ask.

My reason is that this is a whole-process exit (so reporting a thread
doesn't make sense); and that in this run, qemu is not reporting that it
is multi-process-capable (so reporting a PID doesn't make sense).

So, I wonder if process_stop_reply should be modified like (beware,
untested patch):

diff --git a/gdb/remote.c b/gdb/remote.c
index 9b73faf9a34..810df658c54 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7666,7 +7666,7 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply,
 
   /* If no thread/process was reported by the stub then use the first
      non-exited thread in the current target.  */
-  if (ptid == null_ptid)
+  if (ptid == null_ptid && stop_reply->stop_reason != TARGET_WAITKIND_EXITED)
     {
       for (thread_info *thr : all_non_exited_threads (this))
 	{


Perhaps this also applies to some of the other TARGET_WAITKIND_ values
as well?  TARGET_WAITKIND_SIGNALLED seems similar.

thanks,
Tom


  parent reply	other threads:[~2020-03-09 17:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31  7:35 [PATCH] gdb/remote: Ask target for current thread if it doesn't tell us Andrew Burgess
2020-02-26 18:52 ` Andrew Burgess
2020-02-26 19:28 ` Pedro Alves
2020-02-27 16:17   ` [PATCHv2] gdb/remote: Restore support for 'S' stop reply packet Andrew Burgess
2020-02-27 19:46     ` Pedro Alves
2020-02-28 14:03       ` Andrew Burgess
2020-02-28 17:46         ` Pedro Alves
2020-03-02 11:54           ` [PATCHv3 2/2] " Andrew Burgess
2020-03-02 12:25             ` Pedro Alves
2020-03-02 15:19               ` Andrew Burgess
2020-03-02 19:07                 ` Pedro Alves
2020-03-02 19:25                   ` Andrew Burgess
2020-03-09 17:35             ` Tom Tromey [this message]
2020-03-10 19:05               ` Andrew Burgess
2020-03-11 16:23               ` Andrew Burgess
2020-03-11 18:02                 ` Tom Tromey
2020-03-02 11:54           ` [PATCHv3 0/2] " Andrew Burgess
     [not found]             ` <27befec6c761c43f2e1a9e59403644c198cbd75b.1583149853.git.andrew.burgess@embecosm.com>
2020-03-02 12:24               ` [PATCHv3 1/2] gdbserver: Add mechanism to prevent sending T stop packets 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=87d09lwhvr.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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