* printcmd.c (print_scalar_formatted): Truncate addresses to the
authorPeter Schauer <Peter.Schauer@mytum.de>
Wed, 22 Mar 2000 20:55:15 +0000 (20:55 +0000)
committerPeter Schauer <Peter.Schauer@mytum.de>
Wed, 22 Mar 2000 20:55:15 +0000 (20:55 +0000)
size of a target pointer before passing them to print_address.

gdb/ChangeLog
gdb/printcmd.c

index 318aea58f6c4fffc3cd30b570e3464425e8f39bc..47be4f34a24f8458f3af7a92b38bc4cb17c9441e 100644 (file)
@@ -1,3 +1,8 @@
+2000-03-22  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>
+
+       * printcmd.c (print_scalar_formatted):  Truncate addresses to the
+       size of a target pointer before passing them to print_address.
+
 2000-03-22  Mark Kettenis  <kettenis@gnu.org>
 
        * config/i386/tm-i386aix.h (I386_AIX_TARGET): Remove.
index 710f2d2c47825f129d9637763afa71a0d1645c2e..07139dd4ad9daa576331d0b0ecfa695310b7418c 100644 (file)
@@ -443,7 +443,14 @@ print_scalar_formatted (valaddr, type, format, size, stream)
       break;
 
     case 'a':
-      print_address (unpack_pointer (type, valaddr), stream);
+      {
+       /* Truncate address to the size of a target pointer, avoiding
+          shifts larger or equal than the width of a CORE_ADDR.  */
+       CORE_ADDR addr = unpack_pointer (type, valaddr);
+       if (TARGET_PTR_BIT < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+         addr &= ((CORE_ADDR) 1 << TARGET_PTR_BIT) - 1;
+       print_address (addr, stream);
+      }
       break;
 
     case 'c':
This page took 0.027504 seconds and 4 git commands to generate.