Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jwl5L-0005q5-Mo for qemu-devel@nongnu.org; Thu, 15 May 2008 17:33:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jwl5J-0005nj-Da for qemu-devel@nongnu.org; Thu, 15 May 2008 17:33:58 -0400 Received: from [199.232.76.173] (port=44086 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jwl5J-0005ng-BP for qemu-devel@nongnu.org; Thu, 15 May 2008 17:33:57 -0400 Received: from miranda.se.axis.com ([193.13.178.8]:49679) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jwl5H-0000mA-Qn for qemu-devel@nongnu.org; Thu, 15 May 2008 17:33:56 -0400 Received: from axis.com (edgar.se.axis.com [10.93.151.1]) by miranda.se.axis.com (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id m4FLXmbe002984 for ; Thu, 15 May 2008 23:33:48 +0200 Date: Thu, 15 May 2008 23:33:48 +0200 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCH 1/5] gdbstub: replace singlestep q packets with qRcmd packets Message-ID: <20080515213348.GB27300@edgar.se.axis.com> References: <1210860693-22245-1-git-send-email-jason.wessel@windriver.com> <1210860693-22245-2-git-send-email-jason.wessel@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1210860693-22245-2-git-send-email-jason.wessel@windriver.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wessel Cc: qemu-devel@nongnu.org On Thu, May 15, 2008 at 09:11:29AM -0500, Jason Wessel wrote: > At the gdbserial protocol level, using the qRcmd packets allows gdb to > use the "monitor" command to access the controls for single stepping > behavior. Now you can use a gdb "monitor" command instead of a gdb > "maintenance" command. > > The qemu docs were updated to reflect this change. > > Signed-off-by: Jason Wessel Thanks Jason, a few comments inlined. > --- > gdbstub.c | 82 +++++++++++++++++++++++++++++++++++++++++---------------- > qemu-doc.texi | 34 +++++++++++------------ > 2 files changed, 75 insertions(+), 41 deletions(-) > > diff --git a/gdbstub.c b/gdbstub.c > index 9a361e3..4bc7999 100644 > --- a/gdbstub.c > +++ b/gdbstub.c > @@ -239,6 +239,27 @@ static int put_packet(GDBState *s, char *buf) > return 0; > } > > +static void monitor_output(GDBState *s, const char *msg) > +{ > + char *buf; > + int len = strlen(msg); > + > + buf = malloc(len * 2 + 2); > + buf[0] = 'O'; > + memtohex(buf + 1, msg, len); > + put_packet(s, buf); > + free(buf); > +} It feels odd that the code path that ends up here has line_buf, buf and mem_buf available for parsing the query and generating the response and still we need to malloc for more. Isn't there a way to reuse some of that memory? > + > +static void monitor_help(GDBState *s) > +{ > + monitor_output(s, "gdbstub specific monitor commands:\n"); > + monitor_output(s, "s_show -- Show gdbstub Single Stepping variables\n"); > + monitor_output(s, "set s_step <0|1> -- Single Stepping enabled\n"); > + monitor_output(s, "set s_irq <0|1> -- Single Stepping with qemu irq handlers enabled\n"); > + monitor_output(s, "set s_timer <0|1> -- Single Stepping with qemu timers enabled\n"); > +} I'd prefer if either have a show/set interface or we don't, this is kind of a mix. Some suggestions: monitor sstep enable/disable monitor sstep irq/noirq monitor sstep timers/notimers monitor sstep show or: monitor set/show sstep monitor set/show sirq monitor set/show stimers What do you think? Best regards -- Edgar E. Iglesias Axis Communications AB