aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>2000-03-22 20:55:15 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>2000-03-22 20:55:15 +0000
commit593de6a6a5143ca182757080690c01590469e9df (patch)
tree8fb578f5143be9a4037cdcce346f3b6976253ab5 /gdb/printcmd.c
parent1a309862a732b8b9c3b4a0d8497078cc7ae5ac0e (diff)
downloadgdb-593de6a6a5143ca182757080690c01590469e9df.zip
gdb-593de6a6a5143ca182757080690c01590469e9df.tar.gz
gdb-593de6a6a5143ca182757080690c01590469e9df.tar.bz2
* printcmd.c (print_scalar_formatted): Truncate addresses to the
size of a target pointer before passing them to print_address.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 710f2d2..07139dd 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -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':