This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa/amd64] Zero fill 32-bit registers
- From: Mark Kettenis <kettenis at chello dot nl>
- To: ac131313 at redhat dot com
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sat, 28 Feb 2004 11:46:43 +0100 (CET)
- Subject: Re: [rfa/amd64] Zero fill 32-bit registers
- References: <403E9BC3.2030807@redhat.com>
Date: Thu, 26 Feb 2004 20:22:11 -0500
From: Andrew Cagney <ac131313@redhat.com>
Hello,
For a 64-bit gregset, the code was only modifying the low 32-bits of the
register field - leaving the upper 64-bits undefined.
That's not completely unintentional. The idea is to leave any
"reserved" bits untouched, and in a sense for 32-bit stuff the upper
32 bits are "reserved"; they are not necessarily zero, at least not
for all registers.
To prevent the upper 32 bits being "undefined", typical usage of these
functions is:
ptrace (PT_GETREGS, ..., ®s, 0);
amd64_collect_native_gregset (current_regcache, ®s, regnum);
ptrace (PT_SETREGS, ..., ®s, 0);
This, among other things, would lead to mysterious 32-bit thread
failures.
I guess the thread code isn't doing the equivalent of the PT_GETREGS
call. I think the correct way to fix this is to make sure the buffer
is properly initialized before you pass it to
amd64_collect_native_gregset.
Another problem with your patch is that I'd rather like avoid assuming
that the register buffer is an array of 8-byte registers.
Mark