This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: addresses and pointers may be different sizes while printing
- To: Jim Blandy <jimb at cygnus dot com>
- Subject: Re: RFA: addresses and pointers may be different sizes while printing
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Thu, 05 Jul 2001 01:09:22 -0400
- Cc: gdb-patches at sources dot redhat dot com
- References: <20010628223546.BDE7F5E9CB@zwingli.cygnus.com>
Jim,
Would you have an example illustrating the actual affect of this change?
Andrew
> This is a preparatory patch for removing the D10V dependencies that
> have crept into the core of GDB (for example: value_at in valops.c).
>
> The D10V uses 16-bit pointers to index 256k code space. Since all
> D10V instructions are 32 bits long, and naturally aligned, the PC is
> really 18 bits long, and the bottom two bits are always zero. Within
> GDB, we model this by using 32-bit *addresses*, and converting
> *pointers* (which are 16 bits long) to *addresses* at the appropriate
> points.
>
> Without this conversion (which is necessary for some other
> architectures as well), the alternative is for GDB to think that
> pointers are 32 bits long, while the program being debugged thinks
> they're 16 bits long. As you'd expect, chaos results.
>
> In any case, print_scalar_formatted assumes that pointers and the
> addresses they represent are the same length. This isn't true for the
> D10V, so we need to remove that assumption. That's what this patch is
> supposed to do.
>
> There are probably similar problems elsewhere, but we can fix them as
> we find them. I found this one, so I'm fixing it.
>
>