This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] Re: [rfa/amd64] Zero fill 32-bit registers
Date: Sat, 28 Feb 2004 15:39:47 -0500
From: Andrew Cagney <cagney@gnu.org>
> Could you live with just zero-extending the 16 general-purpose
> registers and the instruction pointer? I'll implement it for you.
It is certainly an improvement! Can you test it?
I've tested the attached on SuSE 8.2, with -m32. No changes in the
testoutput for me, but the threaded stuff doesn't work very well on
the system (and probably no at all in on 32x64-bit). I committed it
anyway, since I can't imagine this making things worse for the
threaded stuff if it works for the non-threaded stuff. I'd appreciate
it if you could test whether this fixed the problems you were seeing.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* amd64-nat.c: Include "gdb_string.h".
(amd64_collect_native_gregset): Zero-extend the 32-bit
general-purpose registers and %eip.
Index: amd64-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-nat.c,v
retrieving revision 1.4
diff -u -p -r1.4 amd64-nat.c
--- amd64-nat.c 25 Feb 2004 20:59:12 -0000 1.4
+++ amd64-nat.c 28 Feb 2004 21:54:26 -0000
@@ -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 stru
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;