This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 03/15 v2] Make gdbserver CORE_ADDR unsigned
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Gary Benson <gbenson at redhat dot com>, <gdb-patches at sourceware dot org>, Tom Tromey <tromey at redhat dot com>, Doug Evans <dje at google dot com>
- Date: Fri, 18 Jul 2014 00:10:34 +0100
- Subject: Re: [PATCH 03/15 v2] Make gdbserver CORE_ADDR unsigned
- Authentication-results: sourceware.org; auth=none
- References: <1405520243-17282-1-git-send-email-gbenson at redhat dot com> <1405520243-17282-4-git-send-email-gbenson at redhat dot com> <53C7FCB1 dot 4060904 at redhat dot com>
On Thu, 17 Jul 2014, Pedro Alves wrote:
> The only issue that I think might come out of this is
> that on MIPS, addresses are signed, so pointers are sign
> extended. But we can definitely handle whatever fallout this
> may cause, if any, when we see it. Clearly if GDB's native
> targets can handle that, so should gdbserver's, and in any
> case the issue should be pretty localized. Just pointing it
> out FYI, to keep an eye out for it.
Also SH64 AFAICT, it defines `elf_backend_sign_extend_vma' to true in
bfd/elf32-sh64.c. We have the following comment in gdb/mips-tdep.c:
/* MIPS believes that the PC has a sign extended value. Perhaps the
all registers should be sign extended for simplicity? */
which is of course true in that we need to sign-extend all integer
registers (that includes GPRs and CP0 registers; maybe some control
registers as well); where applicable that is, i.e. debugging a strict
32-bit ABI on 64-bit hardware. Then on the other hand the values in these
registers should already have been truncated to 32 bits and then
sign-extended before they have been written in the first place.
Overall it's tricky, hardware does not always enforce proper
sign-extension required by the ABI, e.g. an o32 kernel-mode program is
free to set GPRs or the PC to a value outside the range supported by the
ABI (the Linux kernel sometimes takes advantage of this possibility), and
we have no way I believe to make the user aware of this happening, while
that might be The Bug they're after.
Maciej