From 593de6a6a5143ca182757080690c01590469e9df Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Wed, 22 Mar 2000 20:55:15 +0000 Subject: [PATCH] * printcmd.c (print_scalar_formatted): Truncate addresses to the size of a target pointer before passing them to print_address. --- gdb/ChangeLog | 5 +++++ gdb/printcmd.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 318aea58f6c..47be4f34a24 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2000-03-22 Peter Schauer + + * 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 * config/i386/tm-i386aix.h (I386_AIX_TARGET): Remove. diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 710f2d2c478..07139dd4ad9 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': -- 2.30.2