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

[Xen-devel] [patch] additional gdbstub fixes



Fix additional gdbstub issues.
- gdbstub.h uses atomic_t and PAGE_SIZE, so include those headers
- do not lie about setting breakpoints
- fix memory writing

Given that breakpoints/stepping and memory writing completely did not work, I 
think a little more testing could have gone in to the common gdbstub.

Note that when the stub does not support the "Z" (breakpoint) command, GDB 
falls back to writing trap instructions directly into memory (which was also 
broken). I have no idea why that comment about "gdb won't let you continue 
the process" was there.

Please apply.

Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>

# HG changeset patch
# User hollisb@xxxxxxxxxxxxxxxxxxxxx
# Node ID c26f6df8adc48b0559f036a803b4c79894303bec
# Parent  2307bf2a4bfc615488a9a606753fbcb021532fcf
fix gdbstub breakpoints, memory writing, and build

diff -r 2307bf2a4bfc -r c26f6df8adc4 xen/common/gdbstub.c
--- a/xen/common/gdbstub.c      Fri Mar  3 18:21:48 2006
+++ b/xen/common/gdbstub.c      Mon Mar  6 21:52:45 2006
@@ -348,7 +348,10 @@
         }
     }
 
-    gdb_write_to_packet_str((x != length) ? "OK" : "E11", ctx);
+    if (x == length)
+        gdb_write_to_packet_str("OK", ctx);
+    else
+        gdb_write_to_packet_str("E11", ctx);
 
     dbg_printk("Write done.\n");
 
@@ -397,13 +400,18 @@
         break;
     case 'M': /* Write memory */
         addr = simple_strtoul(ctx->in_buf + 1, &ptr, 16);
-        if ( (ptr == (ctx->in_buf + 1)) || (ptr[0] != ':') )
+        if ( (ptr == (ctx->in_buf + 1)) || (ptr[0] != ',') )
         {
             gdb_send_reply("E03", ctx);
             return 0;
         }
         length = simple_strtoul(ptr + 1, &ptr, 16);
-        gdb_cmd_write_mem(addr, length, ptr, ctx);
+        if ( ptr[0] != ':')
+        {
+            gdb_send_reply("E04", ctx);
+            return 0;
+        }
+        gdb_cmd_write_mem(addr, length, ptr + 1, ctx);
         break;
     case 'p': /* read register */
         addr = simple_strtoul(ctx->in_buf + 1, &ptr, 16);
@@ -419,12 +427,6 @@
         }
         gdb_arch_read_reg(addr, regs, ctx);
         break;
-    case 'Z': /* We need to claim to support these or gdb
-                 won't let you continue the process. */
-    case 'z':
-        gdb_send_reply("OK", ctx);
-        break;
-
     case 'D':
         ctx->currently_attached = 0;
         gdb_send_reply("OK", ctx);
diff -r 2307bf2a4bfc -r c26f6df8adc4 xen/include/xen/gdbstub.h
--- a/xen/include/xen/gdbstub.h Fri Mar  3 18:21:48 2006
+++ b/xen/include/xen/gdbstub.h Mon Mar  6 21:52:45 2006
@@ -20,6 +20,9 @@
 
 #ifndef __XEN_GDBSTUB_H__
 #define __XEN_GDBSTUB_H__
+
+#include <asm/atomic.h>
+#include <asm/page.h>
 
 #ifdef CRASH_DEBUG
 

-- 
Hollis Blanchard
IBM Linux Technology Center

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.