This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Use read_memory_unsigned_integer when reading to CORE_ADDR
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Klee Dienes <klee at apple dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sat, 5 Oct 2002 22:57:16 -0400
- Subject: Re: [PATCH] Use read_memory_unsigned_integer when reading to CORE_ADDR
- References: <1BE45412-D8D6-11D6-9DA9-00039396EEB8@apple.com>
On Sat, Oct 05, 2002 at 10:48:35PM -0400, Klee Dienes wrote:
> The following patch converts several instances of read_memory_integer
> to read_memory_unsigned_integer.
> In all cases except one, the value is being read into a CORE_ADDR,
> which will cause sign-extension lossage if read_memory_integer is used
> with a 64-bit bfd (the final case is reading into an unsigned int, but
> I believe the change is still correct).
>
> 2002-10-05 Klee Dienes <kdienes@apple.com>
>
> * blockframe.c (sigtramp_saved_pc): Use
> read_memory_unsigned_integer to read a value destined for a
> CORE_ADDR, not read_memory_integer.
> * f-valprint.c (f77_get_dynamic_upperbound): Ditto.
> (f77_get_dynamic_lowerbound): Ditto.
> * symfile.c (simple_read_overlay_region_table): Ditto (this
> function is reading to an unsigned int, not a CORE_ADDR, and is
> commented out, but I believe reading as unsigned is still
> correct).
Well, I'm a little concerned about this. MIPS generally wants the
result to be sign extended; the MIPS 32-bit ABIs map onto the lowest
and highest 2G segments of the 64-bit address space, not the low 4G
segment. Isn't there an appropriate function somewhere to read a CORE_ADDR?
Answer: Yes, there is, but it has the same problem. You're just
extending current practice, so I don't see a problem with your patch.
Andrew, is my understanding right? Is there some reason this isn't a
problem?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer