This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
[PATCH] printcmd.c: Truncate output width of p/a and x/a if necessary
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH] printcmd.c: Truncate output width of p/a and x/a if necessary
- From: "Peter.Schauer" <Peter dot Schauer at regent dot e-technik dot tu-muenchen dot de>
- Date: Wed, 22 Mar 2000 21:57:12 MET
FYI,
I checked in the attached patch. It gets rid of the
gdb.base/long_long.exp: x/a &oct
testsuite failure on Solaris 2.7 sparc. For more information see
http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00555.html
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.
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.1.1.8
diff -u -p -r1.1.1.8 printcmd.c
--- printcmd.c 2000/02/05 07:29:47 1.1.1.8
+++ printcmd.c 2000/03/22 20:48:31
@@ -443,7 +443,14 @@ print_scalar_formatted (valaddr, type, f
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':
--
Peter Schauer pes@regent.e-technik.tu-muenchen.de