aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/i386/gdb_machdep.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2004-12-01 06:40:35 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2004-12-01 06:40:35 +0000
commitbcc5241c43307d18ef4cb61b4f98eb624d31367d (patch)
tree62c9a95681df36f1242efe2fd847059217302039 /sys/i386/i386/gdb_machdep.c
parentba1c3b5304db3cc7a986b81bb39a4853904238f0 (diff)
downloadsrc-bcc5241c43307d18ef4cb61b4f98eb624d31367d.tar.gz
src-bcc5241c43307d18ef4cb61b4f98eb624d31367d.zip
Change gdb_cpu_setreg() to not take the value to which to set the
specified register, but a pointer to the in-memory representation of that value. The reason for this is twofold: 1. Not all registers can be represented by a register_t. In particular FP registers fall in that category. Passing the new register value by reference instead of by value makes this point moot. 2. When we receive a G or P packet, both are for writing a register, the packet will have the register value in target-byte order and in the memory representation (modulo the fact that bytes are sent as 2 printable hexadecimal numbers of course). We only need to decode the packet to have a pointer to the register value. This change fixes the bug of extracting the register value of the P packet as a hexadecimal number instead of as a bit array. The quick (and dirty) fix to bswap the register value in gdb_cpu_setreg() as it has been added on i386 and amd64 can therefore be removed and has in fact been that. Tested on: alpha, amd64, i386, ia64, sparc64
Notes
Notes: svn path=/head/; revision=138253
Diffstat (limited to 'sys/i386/i386/gdb_machdep.c')
-rw-r--r--sys/i386/i386/gdb_machdep.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/i386/i386/gdb_machdep.c b/sys/i386/i386/gdb_machdep.c
index 836b13e73b89..042b1041c811 100644
--- a/sys/i386/i386/gdb_machdep.c
+++ b/sys/i386/i386/gdb_machdep.c
@@ -67,15 +67,14 @@ gdb_cpu_getreg(int regnum, size_t *regsz)
}
void
-gdb_cpu_setreg(int regnum, register_t val)
+gdb_cpu_setreg(int regnum, void *val)
{
- val = __bswap32(val);
switch (regnum) {
case GDB_REG_PC:
- kdb_thrctx->pcb_eip = val;
+ kdb_thrctx->pcb_eip = *(register_t *)val;
if (kdb_thread == curthread)
- kdb_frame->tf_eip = val;
+ kdb_frame->tf_eip = *(register_t *)val;
}
}