From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46169) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGFN3-0002tC-7R for qemu-devel@nongnu.org; Thu, 14 Mar 2013 17:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGFMz-0001HX-Gb for qemu-devel@nongnu.org; Thu, 14 Mar 2013 17:07:29 -0400 Received: from e37.co.us.ibm.com ([32.97.110.158]:60614) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGFMz-0001Gw-AU for qemu-devel@nongnu.org; Thu, 14 Mar 2013 17:07:25 -0400 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Mar 2013 15:07:20 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id E85863E40044 for ; Thu, 14 Mar 2013 15:07:06 -0600 (MDT) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2EL7FgT088588 for ; Thu, 14 Mar 2013 15:07:16 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2EL7Ftc024771 for ; Thu, 14 Mar 2013 15:07:15 -0600 Message-ID: <51423C00.1070101@linux.vnet.ibm.com> Date: Thu, 14 Mar 2013 16:07:12 -0500 From: Jesse Larrew MIME-Version: 1.0 References: <1363109492-1901-1-git-send-email-chouteau@adacore.com> <1363109492-1901-2-git-send-email-chouteau@adacore.com> <51422A3D.7000308@siemens.com> In-Reply-To: <51422A3D.7000308@siemens.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4] Add GDB qAttached support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Anthony Liguori , "qemu-devel@nongnu.org" , Fabien Chouteau On 03/14/2013 02:51 PM, Jan Kiszka wrote: > 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 > --- > > As Fabien dropped his attempt to make this configurable, let's > preserve the value of exposing this feature to gdb statically. > > gdbstub.c | 10 ++++++++++ > 1 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/gdbstub.c b/gdbstub.c > index e414ad9..9daee86 100644 > --- a/gdbstub.c > +++ b/gdbstub.c > @@ -42,6 +42,12 @@ > #include "sysemu/kvm.h" > #include "qemu/bitops.h" > > +#ifdef CONFIG_USER_ONLY > +#define GDB_ATTACHED "0" > +#else > +#define GDB_ATTACHED "1" > +#endif > + Yes, I like the #define better. > #ifndef TARGET_CPU_MEMORY_RW_DEBUG > static inline int target_memory_rw_debug(CPUArchState *env, target_ulong addr, > uint8_t *buf, int len, int is_write) > @@ -2491,6 +2497,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) > break; > } > #endif > + if (strncmp(p, "Attached", 8) == 0) { > + put_packet(s, GDB_ATTACHED); > + break; > + } > /* Unrecognised 'q' command. */ > goto unknown_command; > Reviewed-by: Jesse Larrew Jesse Larrew Software Engineer, KVM Team IBM Linux Technology Center Phone: (512) 973-2052 (T/L: 363-2052) jlarrew@linux.vnet.ibm.com