qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@axis.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Debugging vmlinux with qemu and gdb. Unable to step, next, print or to get any information..
Date: Mon, 12 May 2008 11:41:03 +0200	[thread overview]
Message-ID: <20080512094103.GA31632@edgar.se.axis.com> (raw)
In-Reply-To: <20080509144029.GA32414@caradoc.them.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
 

  parent reply	other threads:[~2008-05-12  9:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-08  7:53 [Qemu-devel] Debugging vmlinux with qemu and gdb. Unable to step, next, print or to get any information Keilhau Timo ( Student )
2008-05-08  8:28 ` [Qemu-devel] " Jan Kiszka
2008-05-08  9:09   ` Keilhau Timo ( Student )
2008-05-08 18:39     ` Jan Kiszka
2008-05-09  2:31 ` [Qemu-devel] " Mulyadi Santosa
2008-05-09  4:39   ` Jason Wessel
2008-05-09  7:23     ` Mulyadi Santosa
2008-05-09  8:29       ` Jan Kiszka
2008-05-09  9:03       ` Keilhau Timo ( Student )
2008-05-09 10:03         ` Mulyadi Santosa
2008-05-09  8:38     ` Edgar E. Iglesias
2008-05-09 14:40     ` Daniel Jacobowitz
2008-05-09 14:47       ` Jason Wessel
2008-05-09 16:39         ` Daniel Jacobowitz
2008-05-12  9:41       ` Edgar E. Iglesias [this message]
2008-05-12 12:51         ` Jason Wessel
2008-05-12 13:30           ` Edgar E. Iglesias
2008-05-12 14:02           ` Edgar E. Iglesias
2008-05-12 14:31             ` Jason Wessel
2008-05-12 14:33             ` Paul Brook
2008-05-12 14:47               ` Edgar E. Iglesias
2008-05-12 14:48               ` Jason Wessel
2008-05-12 12:51         ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080512094103.GA31632@edgar.se.axis.com \
    --to=edgar.iglesias@axis.com \
    --cc=drow@false.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).