public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix bug in previous remote unique_ptr change
@ 2023-12-20 20:25 Pedro Alves
  0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2023-12-20 20:25 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aed77b16f17fc3ed9c952af632674dc25d0dfdb5

commit aed77b16f17fc3ed9c952af632674dc25d0dfdb5
Author: Pedro Alves <pedro@palves.net>
Date:   Wed Dec 20 20:11:23 2023 +0000

    Fix bug in previous remote unique_ptr change
    
    By inspection, I noticed that the previous patch went too far, here:
    
     @@ -7705,7 +7713,8 @@ remote_target::discard_pending_stop_replies (struct inferior *inf)
        if (rs->remote_desc == NULL)
          return;
    
     -  reply = (struct stop_reply *) rns->pending_event[notif_client_stop.id];
     +  stop_reply_up reply
     +    = as_stop_reply_up (std::move (rns->pending_event[notif_client_stop.id]));
    
        /* Discard the in-flight notification.  */
        if (reply != NULL && reply->ptid.pid () == inf->pid)
    
    That is always moving the stop reply from pending_event, when we only
    really want to peek into it.  The code further below that even says:
    
      /* Discard the in-flight notification.  */
      if (reply != NULL && reply->ptid.pid () == inf->pid)
        {
          /* Leave the notification pending, since the server expects that
             we acknowledge it with vStopped.  But clear its contents, so
             that later on when we acknowledge it, we also discard it.  */
    
    This commit reverts that hunk back, adjusted to use unique_ptr::get().
    
    Change-Id: Ifc809d1a8225150a4656889f056d51267100ee24

Diff:
---
 gdb/remote.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index f3823bb9c76..dcc1a0d0639 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -7713,8 +7713,9 @@ remote_target::discard_pending_stop_replies (struct inferior *inf)
   if (rs->remote_desc == NULL)
     return;
 
-  stop_reply_up reply
-    = as_stop_reply_up (std::move (rns->pending_event[notif_client_stop.id]));
+  struct notif_event *notif_event
+    = rns->pending_event[notif_client_stop.id].get ();
+  auto *reply = static_cast<stop_reply *> (notif_event);
 
   /* Discard the in-flight notification.  */
   if (reply != NULL && reply->ptid.pid () == inf->pid)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-20 20:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20 20:25 [binutils-gdb] Fix bug in previous remote unique_ptr change Pedro Alves

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).