qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Debugging vmlinux with qemu and gdb. Unable to step, ne


From: Edgar E. Iglesias
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
User-agent: Mutt/1.5.16 (2007-06-09)

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:
> > address@hidden 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
address@hidden maintenance packet qqemu.sstepbits
address@hidden 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
address@hidden maintenance packet qqemu.sstep
address@hidden 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
address@hidden maintenance packet Qqemu.sstep=HEX_VALUE
address@hidden 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
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]