From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23588 invoked by alias); 8 Jul 2009 08:03:14 -0000 Received: (qmail 23447 invoked by uid 22791); 8 Jul 2009 08:03:13 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.154) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Jul 2009 08:03:00 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id n6882u2F072921 for ; Wed, 8 Jul 2009 10:02:56 +0200 (CEST) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id n6882u3T051475 for ; Wed, 8 Jul 2009 10:02:56 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) Received: from d620muller (www-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id n6882uu7018618 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Wed, 8 Jul 2009 10:02:56 +0200 (CEST) (envelope-from muller@ics.u-strasbg.fr) From: "Pierre Muller" To: Subject: [RFA] Avoid internal error in paddress Date: Wed, 08 Jul 2009 08:03:00 -0000 Message-ID: <000501c9ffa2$7ed3e2d0$7c7ba870$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00225.txt.bz2 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 * 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;