Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFA] Avoid internal error in paddress
Date: Wed, 08 Jul 2009 08:03:00 -0000	[thread overview]
Message-ID: <000501c9ffa2$7ed3e2d0$7c7ba870$@u-strasbg.fr> (raw)

  I reported an internal error
in gdbtui at startup
concerning the recently modified paddress function:
 
http://sourceware.org/ml/gdb/2009-07/msg00052.html

  I suspect that this internal error could bite
us elsewhere, this is why I propose the following patch:


Pierre Muller
Pascal language support maintainer for GDB

Tested on gcc16 Compiler Farm:
the changes found do not seem to be related to the patch...
< Test Run By muller on Wed Jul  8 09:44:56 2009 (without patch)
---
> Test Run By muller on Wed Jul  8 09:17:05 2009 (with patch)
3512c3512
< PASS: gdb.base/foll-fork.exp: set follow child, hit tbreak
---
> FAIL: gdb.base/foll-fork.exp: (timeout) set follow child, hit tbreak
3524c3524
< PASS: gdb.base/foll-fork.exp: set follow parent, hit tbreak
---
> FAIL: gdb.base/foll-fork.exp: (timeout) set follow parent, hit tbreak

2009-07-08  Pierre Muller  <muller@ics.u-strasbg.fr>

	* utils.c (paddress): Handle case of NULL GDBARCH parameter.

Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.213
diff -u -p -r1.213 utils.c
--- utils.c	2 Jul 2009 17:21:07 -0000	1.213
+++ utils.c	8 Jul 2009 07:04:20 -0000
@@ -2859,7 +2859,12 @@ paddress (struct gdbarch *gdbarch, CORE_
      either zero or sign extended.  Should gdbarch_address_to_pointer or
      some ADDRESS_TO_PRINTABLE() be used to do the conversion?  */
 
-  int addr_bit = gdbarch_addr_bit (gdbarch);
+  int addr_bit;
+  /* Avoid internal error by using CORE_ADDR size if gdbarch is NULL.  */
+  if (gdbarch)
+    addr_bit = gdbarch_addr_bit (gdbarch);
+  else
+    addr_bit = sizeof (CORE_ADDR) * HOST_CHAR_BIT;
 
   if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
     addr &= ((CORE_ADDR) 1 << addr_bit) - 1;


             reply	other threads:[~2009-07-08  8:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-08  8:03 Pierre Muller [this message]
2009-07-08 12:10 ` Ulrich Weigand

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='000501c9ffa2$7ed3e2d0$7c7ba870$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=gdb-patches@sourceware.org \
    /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