From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JvUWv-0003ZP-GB for qemu-devel@nongnu.org; Mon, 12 May 2008 05:41:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JvUWu-0003YQ-Cl for qemu-devel@nongnu.org; Mon, 12 May 2008 05:41:12 -0400 Received: from [199.232.76.173] (port=47347 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JvUWt-0003YB-Ju for qemu-devel@nongnu.org; Mon, 12 May 2008 05:41:11 -0400 Received: from miranda.se.axis.com ([193.13.178.8]:57203) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JvUWt-000681-3v for qemu-devel@nongnu.org; Mon, 12 May 2008 05:41:11 -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 m4C9f3Lt008930 for ; Mon, 12 May 2008 11:41:03 +0200 Date: Mon, 12 May 2008 11:41:03 +0200 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] Debugging vmlinux with qemu and gdb. Unable to step, next, print or to get any information.. Message-ID: <20080512094103.GA31632@edgar.se.axis.com> References: <824D057211107844BA95DB341B4BF12E01139BF2@hanvsmail04.eu.thmulti.com> <4823D56F.1010600@windriver.com> <20080509144029.GA32414@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080509144029.GA32414@caradoc.them.org> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Daniel Jacobowitz Cc: qemu-devel@nongnu.org On Fri, May 09, 2008 at 10:40:29AM -0400, Daniel Jacobowitz wrote: > On Thu, May 08, 2008 at 11:39:11PM -0500, Jason Wessel wrote: > > +@item maintenance packet qqemu.sstepbits > > Are these packets in wide use yet? If not, I'd really recommend you > use qRcmd instead; then the GDB command is just "monitor", e.g. > "monitor show sstepbits". maint packet isn't really intended for > users. Thanks for the comments Daniel. This patch tries to change the syntax into this: % monitor sstepbits % monitor sstep % monitor sstep=0x05 Or would a show/set interface be prefered for some reason (e.g, monitor show sstepbits, monitor show sstep, monitor set sstep 0x5)? Best regards, -- Edgar E. Iglesias Axis Communications AB Index: gdbstub.c =================================================================== --- gdbstub.c (revision 4432) +++ gdbstub.c (working copy) @@ -1115,29 +1115,40 @@ case 'q': case 'Q': /* parse any 'q' packets here */ - if (!strcmp(p,"qemu.sstepbits")) { - /* Query Breakpoint bit definitions */ - sprintf(buf,"ENABLE=%x,NOIRQ=%x,NOTIMER=%x", - SSTEP_ENABLE, - SSTEP_NOIRQ, - SSTEP_NOTIMER); - put_packet(s, buf); - break; - } else if (strncmp(p,"qemu.sstep",10) == 0) { - /* Display or change the sstep_flags */ - p += 10; - if (*p != '=') { - /* Display current setting */ - sprintf(buf,"0x%x", sstep_flags); - put_packet(s, buf); - break; - } - p++; - type = strtoul(p, (char **)&p, 16); - sstep_flags = type; - put_packet(s, "OK"); - break; - } + if (!strncmp(p, "Rcmd,", 5)) { + p += 5; + len = strlen(p); + hextomem(mem_buf, p, len); + mem_buf[(len >> 1)] = 0; + + /* match hex for 'sstepbits'. */ + if (!strcmp(mem_buf,"sstepbits")) { + /* Query Breakpoint bit definitions */ + len = sprintf(mem_buf, + "ENABLE=%x,NOIRQ=%x,NOTIMER=%x\n", + SSTEP_ENABLE, + SSTEP_NOIRQ, + SSTEP_NOTIMER); + memtohex(buf, mem_buf, len); + put_packet(s, buf); + break; + } else if (!strncmp(mem_buf, "sstep", 5)) { + /* Display or change the sstep_flags */ + if (mem_buf[5] != '=') { + /* Display current setting */ + len = sprintf(mem_buf,"0x%x\n", sstep_flags); + memtohex(buf, mem_buf, len); + put_packet(s, buf); + break; + } + p++; + /* TODO: Add error checking. */ + type = strtoul(mem_buf + 6, NULL, 16); + sstep_flags = type; + put_packet(s, "OK"); + break; + } + } #ifdef CONFIG_LINUX_USER else if (strncmp(p, "Offsets", 7) == 0) { TaskState *ts = env->opaque; Index: qemu-doc.texi =================================================================== --- qemu-doc.texi (revision 4432) +++ qemu-doc.texi (working copy) @@ -1952,29 +1952,25 @@ The default single stepping behavior is step with the IRQs and timer service routines off. It is set this way because when gdb executes a single step it expects to advance beyond the current instruction. With the IRQs and and timer service routines on, a single step might jump into the one of the interrupt or exception vectors instead of executing the current instruction. This means you may hit the same breakpoint a number of times before executing the instruction gdb wants to have executed. Because there are rare circumstances where you want to single step into an interrupt vector the behavior can be controlled from GDB. There are three commands you can query and set the single step behavior: @table @code -@item maintenance packet qqemu.sstepbits +@item monitor sstepbits This will display the MASK bits used to control the single stepping IE: @example -(gdb) maintenance packet qqemu.sstepbits -sending: "qqemu.sstepbits" -received: "ENABLE=1,NOIRQ=2,NOTIMER=4" +(gdb) monitor sstepbits +ENABLE=1,NOIRQ=2,NOTIMER=4 @end example -@item maintenance packet qqemu.sstep +@item monitor sstep This will display the current value of the mask used when single stepping IE: @example -(gdb) maintenance packet qqemu.sstep -sending: "qqemu.sstep" -received: "0x7" +(gdb) monitor sstep +0x7 @end example -@item maintenance packet Qqemu.sstep=HEX_VALUE +@item monitor sstep=HEX_VALUE This will change the single step mask, so if wanted to enable IRQs on the single step, but not timers, you would use: @example -(gdb) maintenance packet Qqemu.sstep=0x5 -sending: "qemu.sstep=0x5" -received: "OK" +(gdb) monitor sstep=0x5 @end example @end table