public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdbserver: Fix vAttach response when attaching is not supported
@ 2024-04-26 20:24 Pedro Alves
  0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2024-04-26 20:24 UTC (permalink / raw)
  To: gdb-cvs

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

commit ef27d39dd2c2e7b6af70884895e6d751872ae305
Author: Pedro Alves <pedro@palves.net>
Date:   Fri Apr 19 14:37:56 2024 +0100

    gdbserver: Fix vAttach response when attaching is not supported
    
    handle_v_attach calls attach_inferior, which says:
    
      "return -1 if attaching is unsupported, 0 if it succeeded, and call
      error() otherwise."
    
    So if attach_inferior return != 0, we have the unsupported case,
    meaning we should return the empty packet instead of an error.
    
    In practice, this shouldn't trigger, as vAttach support is supposed to
    be reported via qSupported.  But it doesn't hurt to be pedantic here.
    
    Change-Id: I99cce6fa678f2370571e6bca0657451300956127
    Approved-By: Tom Tromey <tom@tromey.com>

Diff:
---
 gdbserver/server.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 2633df08ddb..789af36d9a4 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -3318,7 +3318,10 @@ handle_v_attach (char *own_buf)
 	    prepare_resume_reply (own_buf, cs.last_ptid, cs.last_status);
 	}
       else
-	write_enn (own_buf);
+	{
+	  /* Not supported.  */
+	  own_buf[0] = 0;
+	}
     }
   catch (const gdb_exception_error &exception)
     {

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

only message in thread, other threads:[~2024-04-26 20:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26 20:24 [binutils-gdb] gdbserver: Fix vAttach response when attaching is not supported 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).