This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: print-address.patch
- To: David Taylor <taylor at cygnus dot com>
- Subject: Re: print-address.patch
- From: Doug Evans <dje at transmeta dot com>
- Date: Thu, 8 Feb 2001 09:35:41 -0800 (PST)
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <200102081622.LAA07648@texas.cygnus.com>
David Taylor writes:
> Date: Wed, 7 Feb 2001 23:22:25 -0800
> From: Doug Evans <dje@transmeta.com>
>
> The comment in print_address_numeric claims it's casting the address
> to the size of [TARGET_]PTR_BIT (which sounds correct to me),
> when in fact it's using TARGET_ADDR_BIT.
>
> Then the comment is wrong. It should indeed be using TARGET_ADDR_BIT.
>
> print_address_numeric is printing an *ADDRESS* not a *POINTER*, so
> TARGET_ADDR_BIT is the right thing to use.
I'm not sure I buy that, given this comment in the todo list.
[also in the code methinks]
---
printcmd.c (print_address_numeric):
NOTE: This assumes that the significant address information is kept in
the least significant bits of ADDR - the upper bits were either zero
or sign extended. Should ADDRESS_TO_POINTER() or some
ADDRESS_TO_PRINTABLE() be used to do the conversion?
---
In the case of ptr_bit == 32 and addr_bit == 64,
seems to me like the code is intending to chop the upper 32 bits off:
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
Question: when is addr_bit < sizeof (CORE_ADDR)?