OSDN Git Service

* printcmd.c (print_scalar_formatted): If we are printing an
authorJim Blandy <jimb@codesourcery.com>
Tue, 10 Jul 2001 21:17:49 +0000 (21:17 +0000)
committerJim Blandy <jimb@codesourcery.com>
Tue, 10 Jul 2001 21:17:49 +0000 (21:17 +0000)
address, remember that TARGET_ADDR_BIT is not always equal to
TARGET_PTR_BIT.

gdb/ChangeLog
gdb/printcmd.c

index f439aed..13d66da 100644 (file)
@@ -1,5 +1,9 @@
 2001-07-10  Jim Blandy  <jimb@redhat.com>
 
+       * printcmd.c (print_scalar_formatted): If we are printing an
+       address, remember that TARGET_ADDR_BIT is not always equal to
+       TARGET_PTR_BIT.
+
        * valops.c (value_cast): When casting a pointer to an integer,
        don't convert it to an address.
 
index 746a064..63b7464 100644 (file)
@@ -390,6 +390,12 @@ print_scalar_formatted (char *valaddr, struct type *type, int format, int size,
   else if (format != 'f')
     val_long = unpack_long (type, valaddr);
 
+  /* If the value is a pointer, and pointers and addresses are not the
+     same, then at this point, the value's length is TARGET_ADDR_BIT, not
+     TYPE_LENGTH (type).  */
+  if (TYPE_CODE (type) == TYPE_CODE_PTR)
+    len = TARGET_ADDR_BIT;
+
   /* If we are printing it as unsigned, truncate it in case it is actually
      a negative signed value (e.g. "print/u (short)-1" should print 65535
      (if shorts are 16 bits) instead of 4294967295).  */