winedbg: Improve the register conversion to support over 64-bit registers.

This commit is contained in:
Akihiro Sagawa 2013-05-08 21:11:16 +09:00 committed by Alexandre Julliard
parent b2de0880ec
commit e06fd8d003
1 changed files with 39 additions and 24 deletions

View File

@ -446,6 +446,10 @@ static inline DWORD64 cpu_register(CONTEXT* ctx, unsigned idx)
}
static inline void cpu_register_hex_from(CONTEXT* ctx, unsigned idx, const char** phex)
{
if (cpu_register_map[idx].gdb_length == cpu_register_map[idx].ctx_length)
hex_from(cpu_register_ptr(ctx, idx), *phex, cpu_register_map[idx].gdb_length);
else
{
DWORD64 val = 0;
unsigned i;
@ -465,6 +469,7 @@ static inline void cpu_register_hex_from(CONTEXT* ctx, unsigned idx, const
default: assert(0);
}
}
}
/* =============================================== *
* W I N 3 2 D E B U G I N T E R F A C E *
@ -1009,6 +1014,10 @@ static enum packet_return packet_reply_error(struct gdb_context* gdbctx, int err
}
static inline void packet_reply_register_hex_to(struct gdb_context* gdbctx, unsigned idx)
{
if (cpu_register_map[idx].gdb_length == cpu_register_map[idx].ctx_length)
packet_reply_hex_to(gdbctx, cpu_register_ptr(&gdbctx->context, idx), cpu_register_map[idx].gdb_length);
else
{
DWORD64 val = cpu_register(&gdbctx->context, idx);
unsigned i;
@ -1020,6 +1029,7 @@ static inline void packet_reply_register_hex_to(struct gdb_context* gdbctx, unsi
val >>= 8;
}
}
}
/* =============================================== *
* P A C K E T H A N D L E R S *
@ -1573,8 +1583,13 @@ static enum packet_return packet_read_register(struct gdb_context* gdbctx)
return packet_error;
}
if (gdbctx->trace & GDBPXY_TRC_COMMAND)
{
if (cpu_register_map[reg].ctx_length <= sizeof(DWORD64))
fprintf(stderr, "Read register %x => %08x%08x\n", reg,
(unsigned)(cpu_register(pctx, reg) >> 32), (unsigned)cpu_register(pctx, reg));
else
fprintf(stderr, "Read register %x\n", reg);
}
packet_reply_open(gdbctx);
packet_reply_register_hex_to(gdbctx, reg);
packet_reply_close(gdbctx);