This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] gdbserver fetch/store registers problem on s390x
- From: Daniel Jacobowitz <drow at false dot org>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sun, 15 May 2005 14:28:26 -0400
- Subject: Re: [RFA] gdbserver fetch/store registers problem on s390x
- References: <200505101654.j4AGsTCj028703@53v30g15.boeblingen.de.ibm.com>
On Tue, May 10, 2005 at 06:54:28PM +0200, Ulrich Weigand wrote:
> Hello,
>
> this patch fixes another problem with gdbserver on s390x occurring
> on recent kernels. The problem is that some registers accessed by
> ptrace (notably the access registers and the floating-point status
> register) are still 32 bits wide, even though the PTRACE_PEEKUSER
> and PTRACE_POKEUSER commands always transfer 64 bits.
>
> This is a problem for two reasons: when fetching those registers,
> a 4-byte buffer is allocated via alloca, but then 8 bytes are
> written to that buffer (which just happens to work because alloca
> rounds the size up to the next multiple of 8 anyway). The same
> holds for storing the register; but in this case the second 4 bytes
> have just random contents, and recent kernels won't allow the POKEUSER
> command to succeed unless those extra bytes are zero.
>
> The following patch fixes this problem by always allocating a buffer
> that has multiple of sizeof (PTRACE_XFER_TYPE) as size, and by
> zeroing out the excess bytes of the buffer when storing the register.
>
> Tested on s390-ibm-linux and s390x-ibm-linux.
> OK?
This is OK. Thank you!
--
Daniel Jacobowitz
CodeSourcery, LLC