Eric Pouech : winedbg: Implemented the pXX request in gdb proxy.

Alexandre Julliard julliard at winehq.org
Mon Feb 4 08:43:16 CST 2008


Module: wine
Branch: master
Commit: 336c000d4eb7df7f1cacf6f420f8c924444ea37d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=336c000d4eb7df7f1cacf6f420f8c924444ea37d

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Fri Feb  1 21:26:47 2008 +0100

winedbg: Implemented the pXX request in gdb proxy.

---

 programs/winedbg/gdbproxy.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 4f83c72..d68bff4 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -1385,6 +1385,33 @@ static enum packet_return packet_write_memory(struct gdb_context* gdbctx)
     return packet_ok; /* FIXME: error while writing ? */
 }
 
+static enum packet_return packet_read_register(struct gdb_context* gdbctx)
+{
+    unsigned            reg;
+    CONTEXT             ctx;
+    CONTEXT*            pctx = &gdbctx->context;
+
+    assert(gdbctx->in_trap);
+    reg = hex_to_int(gdbctx->in_packet, gdbctx->in_packet_len);
+    if (reg >= cpu_num_regs)
+    {
+        if (gdbctx->trace & GDBPXY_TRC_COMMAND_ERROR)
+            fprintf(stderr, "Register out of bounds %x (%x)\n", reg, cpu_num_regs);
+        return packet_error;
+    }
+    if (dbg_curr_thread != gdbctx->other_thread && gdbctx->other_thread)
+    {
+        if (!fetch_context(gdbctx, gdbctx->other_thread->handle, pctx = &ctx))
+            return packet_error;
+    }
+    if (gdbctx->trace & GDBPXY_TRC_COMMAND)
+        fprintf(stderr, "Read register %x => %lx\n", reg, *cpu_register(pctx, reg));
+    packet_reply_open(gdbctx);
+    packet_reply_hex_to(gdbctx, cpu_register(pctx, reg), 4);
+    packet_reply_close(gdbctx);
+    return packet_done;
+}
+
 static enum packet_return packet_write_register(struct gdb_context* gdbctx)
 {
     unsigned            reg;
@@ -1931,7 +1958,7 @@ static struct packet_entry packet_entries[] =
         {'H', packet_thread},
         {'m', packet_read_memory},
         {'M', packet_write_memory},
-        /* {'p', packet_read_register}, doesn't seem needed */
+        {'p', packet_read_register},
         {'P', packet_write_register},
         {'q', packet_query},
         /* {'Q', packet_set}, */




More information about the wine-cvs mailing list