print-address.patch

David Taylor taylor@cygnus.com
Thu Feb 8 08:22:00 GMT 2001


    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.

[For most targets, TARGET_ADDR_BIT and TARGET_PTR_BIT are identical.
For Harvard architecture targets and similar situations, they are
generally different (NOTE: TARGET_ADDR_BIT >= TARGET_PTR_BIT).

For the d10v (a target with separate instruction and data addresses),
they are identical primarily due to lies and kludges.  Hopefully these
will eventually go away.]

    2001-02-07  Doug Evans  <dje@casey.transmeta.com>

	    * printcmd.c (print_address_numeric): Reduce address to
	    size of TARGET_PTR_BIT, not TARGET_ADDR_BIT.

    *** printcmd.c.~1~      Tue Dec 19 00:40:47 2000
    --- printcmd.c  Wed Feb  7 23:16:58 2001
    *************** print_address_numeric (CORE_ADDR addr, i
    *** 726,734 ****
	   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?  */
    !   int addr_bit = TARGET_ADDR_BIT;
    !   if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
    !     addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
	print_longest (stream, 'x', use_local, (ULONGEST) addr);
      }

    --- 726,734 ----
	   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?  */
    !   int ptr_bit = TARGET_PTR_BIT;
    !   if (ptr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
    !     addr &= ((CORE_ADDR) 1 << ptr_bit) - 1;
	print_longest (stream, 'x', use_local, (ULONGEST) addr);
      }




More information about the Gdb-patches mailing list