From a72d8a8e4b3ebfaa20f53a35103e3b3946f31daa Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 26 Mar 2007 13:54:30 +0000 Subject: [PATCH] * ui-out.c (ui_out_field_core_addr): Truncate address to TARGET_ADDR_BIT size before printing. --- gdb/ChangeLog | 8 +++++++- gdb/ui-out.c | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 634f463ed5a..2f682ef3335 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ +2007-03-26 Nigel Stephens + Maciej W. Rozycki + + * ui-out.c (ui_out_field_core_addr): Truncate address to + TARGET_ADDR_BIT size before printing. + 2007-03-22 Nigel Stephens - Maciej W. Rozycki + Maciej W. Rozycki * remote-mips.c (mips_xfer_memory): Update prototype. diff --git a/gdb/ui-out.c b/gdb/ui-out.c index ba61c9a882b..eec2d401d58 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -493,12 +493,17 @@ ui_out_field_core_addr (struct ui_out *uiout, CORE_ADDR address) { char addstr[20]; + int addr_bit = TARGET_ADDR_BIT; + + /* Truncate address to match deprecated_print_address_numeric(). */ + if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) + address &= ((CORE_ADDR) 1 << addr_bit) - 1; /* FIXME: cagney/2002-05-03: Need local_address_string() function that returns the language localized string formatted to a width based on TARGET_ADDR_BIT. */ /* deprecated_print_address_numeric (address, 1, local_stream); */ - if (TARGET_ADDR_BIT <= 32) + if (addr_bit <= 32) strcpy (addstr, hex_string_custom (address, 8)); else strcpy (addstr, hex_string_custom (address, 16)); -- 2.30.2