Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Avoid internal error in paddress
@ 2009-07-08  8:03 Pierre Muller
  2009-07-08 12:10 ` Ulrich Weigand
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Muller @ 2009-07-08  8:03 UTC (permalink / raw)
  To: gdb-patches

  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;


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

end of thread, other threads:[~2009-07-08 12:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-08  8:03 [RFA] Avoid internal error in paddress Pierre Muller
2009-07-08 12:10 ` Ulrich Weigand

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