Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* ui-out.c: Truncate address like deprecated_print_address_numeric()
@ 2007-03-26 13:19 Maciej W. Rozycki
  2007-03-26 13:28 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej W. Rozycki @ 2007-03-26 13:19 UTC (permalink / raw)
  To: gdb-patches; +Cc: Nigel Stephens, Maciej W. Rozycki

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));


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-26 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-26 13:19 ui-out.c: Truncate address like deprecated_print_address_numeric() Maciej W. Rozycki
2007-03-26 13:28 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox