This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
ui-out.c: Truncate address like deprecated_print_address_numeric()
- From: "Maciej W. Rozycki" <macro at mips dot com>
- To: gdb-patches at sourceware dot org
- Cc: Nigel Stephens <nigel at mips dot com>, "Maciej W. Rozycki" <macro at linux-mips dot org>
- Date: Mon, 26 Mar 2007 14:19:12 +0100 (BST)
- Subject: ui-out.c: Truncate address like deprecated_print_address_numeric()
Hello,
The following change fixes this test case failure:
break *0x80020278
Breakpoint 3 at 0x80020278: file /n/bank/raid/macro/src7-mdi/combined/gdb/testsuite/gdb.base/consecutive.c, line 10.
(gdb) PASS: gdb.base/consecutive.exp: set bp, 2nd instr
step
Breakpoint 3, 0xffffffff80020278 in foo () at /n/bank/raid/macro/src7-mdi/combined/gdb/testsuite/gdb.base/consecutive.c:10
10 return a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6];
(gdb) FAIL: gdb.base/consecutive.exp: stopped at bp, 2nd instr (wrong address)
This change has been tested natively for mips-unknown-linux-gnu and
remotely for mipsisa32-sde-elf, using mips-sim-sde32/-EB and
mips-sim-sde32/-EL as the targets, with no regressions for the former and
removing the failure for the two latters.
2007-03-26 Nigel Stephens <nigel@mips.com>
Maciej W. Rozycki <macro@mips.com>
* ui-out.c (ui_out_field_core_addr): Truncate address to
TARGET_ADDR_BIT size before printing.
OK to apply?
Maciej
12110-0.diff
Index: binutils-quilt/src/gdb/ui-out.c
===================================================================
--- binutils-quilt.orig/src/gdb/ui-out.c 2007-03-26 14:11:41.000000000 +0100
+++ binutils-quilt/src/gdb/ui-out.c 2007-03-26 14:15:45.000000000 +0100
@@ -493,12 +493,17 @@
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));