From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHULw-0004xR-U8 for qemu-devel@nongnu.org; Sat, 31 Jan 2015 04:28:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHULt-0005gR-IE for qemu-devel@nongnu.org; Sat, 31 Jan 2015 04:28:32 -0500 Message-ID: <54CCA038.8000704@web.de> Date: Sat, 31 Jan 2015 10:28:24 +0100 From: Jan Kiszka MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="q2KRDC0KxRJ9RQBWvqdGHvuhr8G7CKNs7" Subject: [Qemu-devel] [PATCH 1/2] Add GDB qAttached support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-trivial Cc: qemu-devel , Fabien Chouteau This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --q2KRDC0KxRJ9RQBWvqdGHvuhr8G7CKNs7 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable From: Jan Kiszka With this patch QEMU handles qAttached request from gdb. When QEMU replies 1, GDB sends a "detach" command at the end of a debugging session otherwise GDB sends "kill". The default value for qAttached is 1 on system emulation and 0 on user emulation. Based on original version by Fabien Chouteau. Signed-off-by: Jan Kiszka --- Long pending in my queue. Hope we can finally get these two in via trivial (that's what they are). gdbstub.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index e4a1a79..da3e7cb 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -41,6 +41,12 @@ #include "qemu/sockets.h" #include "sysemu/kvm.h" =20 +#ifdef CONFIG_USER_ONLY +#define GDB_ATTACHED "0" +#else +#define GDB_ATTACHED "1" +#endif + static inline int target_memory_rw_debug(CPUState *cpu, target_ulong add= r, uint8_t *buf, int len, bool is_= write) { @@ -1187,6 +1193,10 @@ static int gdb_handle_packet(GDBState *s, const ch= ar *line_buf) put_packet_binary(s, buf, len + 1); break; } + if (strncmp(p, "Attached", 8) =3D=3D 0) { + put_packet(s, GDB_ATTACHED); + break; + } /* Unrecognised 'q' command. */ goto unknown_command; =20 --=20 2.1.4 --q2KRDC0KxRJ9RQBWvqdGHvuhr8G7CKNs7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlTMoDgACgkQitSsb3rl5xQzNACfd64a0RgWlRFEaD2yuby9U+AP VGsAoLlbV136SjkdMUORaizqonNLNQUs =m+xU -----END PGP SIGNATURE----- --q2KRDC0KxRJ9RQBWvqdGHvuhr8G7CKNs7--