This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: RFA: print addresses that are longer than pointers, take two
- To: Jim Blandy <jimb at cygnus dot com>
- Subject: Re: RFA: print addresses that are longer than pointers, take two
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 28 Apr 2000 10:36:33 +1000
- CC: gdb-patches at sourceware dot cygnus dot com
- Organization: Cygnus Solutions
- References: <200004270025.TAA03409@zwingli.cygnus.com> <npem7rjudn.fsf@zwingli.cygnus.com>
Jim Blandy wrote:
>
> This is yet a third amendment to address printing in printcmd.c.
>
> I recently made changes which allow GDB to handle architectures on
> which addresses are larger than pointers. However, the code which
> Peter Schauer added to printcmd.c to handle unwanted sign extension
> assumes that addresses and pointers are the same size.
>
> As it turns out, this masking is unnecessary when the value being
> printed is a genuine pointer; the sign extension won't occur, and the
> masking is unneeded.
There is an important question here. How should GDB internally
represent an address obtained from C pointer values in memory when
TARGET_PTR_BIT (ie C pointer) < ``TARGET_CORE_ADDR_BIT''? Should it
sign extend it (as some architectures do) or not as others do.
Yes this kind of goes back to the dreaded tx49, which I'm just starting
to untangle. The mapping between CORE_ADDR <-> TARGET_PTR_BIT <->
symbol address needs to be clearly defined. If I know what the behavour
is ment to be I can probably sort out the tx49 (and a few other) cases.
> This also rewrites the mask generation in a way which I think is
> overflow-free, without needing to pull the wool over the compiler's
> eyes.
Thanks :-)
Andrew