From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEbHQ-0002Bm-1X for qemu-devel@nongnu.org; Sun, 10 Mar 2013 04:06:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UEbHO-00011C-E3 for qemu-devel@nongnu.org; Sun, 10 Mar 2013 04:06:51 -0400 Received: from mout.web.de ([212.227.17.11]:59698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UEbHO-00010o-4r for qemu-devel@nongnu.org; Sun, 10 Mar 2013 04:06:50 -0400 Message-ID: <513C3F11.5060501@web.de> Date: Sun, 10 Mar 2013 09:06:41 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <1362499399-19475-1-git-send-email-chouteau@adacore.com> In-Reply-To: <1362499399-19475-1-git-send-email-chouteau@adacore.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2DRSAMAXFRSUNNJKRJSJE" Subject: Re: [Qemu-devel] [PATCH 1/2] Add GDB qAttached support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fabien Chouteau Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2DRSAMAXFRSUNNJKRJSJE Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2013-03-05 17:03, Fabien Chouteau wrote: > With this patch GDB will issue a "detach" command at the end of a > debugging session instead of a "kill". This behavior can be inverted > with the new option -gdb-not-attached. >=20 > This patch implements the requirement described in Jan Kiszka's patch: > "gdbstub: Do not kill target in system emulation mode". The patch can > therefore be reverted. >=20 > Signed-off-by: Fabien Chouteau > --- > gdbstub.c | 13 ++++++++++++- > include/exec/gdbstub.h | 2 ++ > qemu-options.hx | 7 +++++++ > vl.c | 3 +++ > 4 files changed, 24 insertions(+), 1 deletion(-) >=20 > diff --git a/gdbstub.c b/gdbstub.c > index e414ad9..c0686a9 100644 > --- a/gdbstub.c > +++ b/gdbstub.c > @@ -32,7 +32,6 @@ > #include "monitor/monitor.h" > #include "char/char.h" > #include "sysemu/sysemu.h" > -#include "exec/gdbstub.h" > #endif > =20 > #define MAX_PACKET_LENGTH 4096 > @@ -41,6 +40,9 @@ > #include "qemu/sockets.h" > #include "sysemu/kvm.h" > #include "qemu/bitops.h" > +#include "exec/gdbstub.h" > + > +static bool gdb_attached =3D true; > =20 > #ifndef TARGET_CPU_MEMORY_RW_DEBUG > static inline int target_memory_rw_debug(CPUArchState *env, target_ulo= ng addr, > @@ -2491,6 +2493,10 @@ static int gdb_handle_packet(GDBState *s, const = char *line_buf) > break; > } > #endif > + if (strncmp(p, "Attached", 8) =3D=3D 0) { > + put_packet(s, gdb_attached ? "1" : "0"); > + break; > + } This works as expected for system mode, but now inverts the behaviour for user mode - that's unexpected and not ok. > /* Unrecognised 'q' command. */ > goto unknown_command; > =20 > @@ -3055,3 +3061,8 @@ int gdbserver_start(const char *device) > return 0; > } > #endif > + > +void gdb_set_attached(bool attached) > +{ > + gdb_attached =3D attached; > +} > diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h > index ba20afa..b2d3b13 100644 > --- a/include/exec/gdbstub.h > +++ b/include/exec/gdbstub.h > @@ -50,4 +50,6 @@ int gdbserver_start(const char *port); > /* in gdbstub-xml.c, generated by scripts/feature_to_c.sh */ > extern const char *const xml_builtin[][2]; > =20 > +void gdb_set_attached(bool attached); > + > #endif > diff --git a/qemu-options.hx b/qemu-options.hx > index 6f9334a..026d3eb 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -2988,6 +2988,13 @@ property must be set. These objects are placed = in the > '/objects' path. > ETEXI > =20 > +DEF("gdb-not-attached", 0, QEMU_OPTION_gdb_not_attached, > + "-gdb-not-attached\n" > + " Do not set Gdb remote server in attached mode.\n"= > + " When exiting debugging session, Gdb will send a '= kill'\n" > + " command instead of a 'detach'.\n", > + QEMU_ARCH_ALL) > + First of all, why do we need this configurable? In which use cases do you want attached mode for user emulation or kill mode for system emulation/virtualization? Then, if you can convince us that such a switch is useful, a new top-level command line option is still a no-go. We already have -gdb, so this would have to become an option to it. In any case, I would suggest to add static attached mode first (enabled for system, disable for user), revert my patch and then, optionally, propose an attached mode control. Jan ------enig2DRSAMAXFRSUNNJKRJSJE 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.0.16 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlE8PxUACgkQitSsb3rl5xRHNgCdEQkNYzQoUhA0s9fmu1j0oyFo A6EAoPB01j9g3TnWMxBrmpx3QOZL5icy =/RbO -----END PGP SIGNATURE----- ------enig2DRSAMAXFRSUNNJKRJSJE--