[binutils-gdb] gdb, remote: fix notify debug nullptr dereference

Markus Metzger via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cd52261cfb4d146b30e3a0ce456a582980f5b11b

commit cd52261cfb4d146b30e3a0ce456a582980f5b11b
Author: Markus Metzger <[email protected]>
Date:   Tue Mar 10 05:44:18 2026 +0000

    gdb, remote: fix notify debug nullptr dereference
    
    In remote_target:push_stop_reply, notif debug prints an element that has
    been moved.  Print the element at the destination, instead.
    
    Approved-By: Simon Marchi <[email protected]>

Diff:
---
 gdb/remote.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 1455838c2cf..735774903f3 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8406,7 +8406,7 @@ remote_target::push_stop_reply (stop_reply_up new_event)
   if (notif_debug)
     gdb_printf (gdb_stdlog,
 		"notif: push 'Stop' %s to queue %d\n",
-		new_event->ptid.to_string ().c_str (),
+		rs->stop_reply_queue.back ()->ptid.to_string ().c_str (),
 		int (rs->stop_reply_queue.size ()));
 
   /* Mark the pending event queue only if async mode is currently enabled.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.