]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/printcmd.c
* printcmd.c (print_scalar_formatted): If we are printing an
[thirdparty/binutils-gdb.git] / gdb / printcmd.c
index 746a0646cc0624aa61087288085b8f435a9470a5..63b74649479bf05436d2776210e3c15109c4aadd 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).  */