Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@mips.com>
To: gdb-patches@sourceware.org
Cc: Nigel Stephens <nigel@mips.com>,
	     "Maciej W. Rozycki" <macro@linux-mips.org>
Subject: ui-out.c: Truncate address like deprecated_print_address_numeric()
Date: Mon, 26 Mar 2007 13:19:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0703261325380.32723@perivale.mips.com> (raw)

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


             reply	other threads:[~2007-03-26 13:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26 13:19 Maciej W. Rozycki [this message]
2007-03-26 13:28 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0703261325380.32723@perivale.mips.com \
    --to=macro@mips.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@linux-mips.org \
    --cc=nigel@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox