From 041bd74ba620da092df8278c9be728121d907a42 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 28 Feb 2004 21:55:48 +0000 Subject: [PATCH] * amd64-nat.c: Include "gdb_string.h". (amd64_collect_native_gregset): Zero-extend the 32-bit general-purpose registers and %eip. --- gdb/ChangeLog | 4 ++++ gdb/amd64-nat.c | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e7410214e2d..18b8a5351f0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2004-02-28 Mark Kettenis + * amd64-nat.c: Include "gdb_string.h". + (amd64_collect_native_gregset): Zero-extend the 32-bit + general-purpose registers and %eip. + * amd64-tdep.h: (amd64_collect_fxsave): New prototype. * amd64-tdep.c (amd64_collect_fxsave): New function. (amd64_fill_fxsave): Simply call amd64_collect_fxsave. diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c index 81a87b69e44..1efe47a5698 100644 --- a/gdb/amd64-nat.c +++ b/gdb/amd64-nat.c @@ -24,6 +24,7 @@ #include "regcache.h" #include "gdb_assert.h" +#include "gdb_string.h" #include "i386-tdep.h" #include "amd64-tdep.h" @@ -128,7 +129,17 @@ amd64_collect_native_gregset (const struct regcache *regcache, int i; if (gdbarch_ptr_bit (gdbarch) == 32) - num_regs = amd64_native_gregset32_num_regs; + { + num_regs = amd64_native_gregset32_num_regs; + + /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and + %eip get zero-extended to 64 bits. */ + for (i = 0; i <= I386_EIP_REGNUM; i++) + { + if (regnum == -1 || regnum == i) + memset (regs + amd64_native_gregset_reg_offset (i), 0, 8); + } + } if (num_regs > NUM_REGS) num_regs = NUM_REGS; -- 2.30.2