From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22627 invoked by alias); 1 Sep 2010 19:01:32 -0000 Received: (qmail 22482 invoked by uid 22791); 1 Sep 2010 19:01:31 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Sep 2010 19:01:22 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o81J1IPS016263 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 1 Sep 2010 15:01:18 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o81J1GNW008477; Wed, 1 Sep 2010 15:01:17 -0400 Received: from [10.15.16.129] (dhcp-10-15-16-129.yyz.redhat.com [10.15.16.129]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o81J1FhK017368; Wed, 1 Sep 2010 15:01:15 -0400 Message-ID: <4C7EA30B.7020007@redhat.com> Date: Wed, 01 Sep 2010 19:01:00 -0000 From: sami wagiaalla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Lightning/1.0b2pre Thunderbird/3.1.2 MIME-Version: 1.0 To: Tom Tromey CC: Doug Evans , gdb-patches@sourceware.org Subject: Re: Regression for gdb.stabs/gdb11479.exp [Re: [patch 1/2] Use custom hash function with bcache] References: <4C6946E1.6000709@redhat.com> <4C6D5C83.3050602@redhat.com> <4C756132.5050301@redhat.com> <20100901082539.GA24609@host1.dyn.jankratochvil.net> <20100901161952.GX2986@adacore.com> <20100901164716.GY2986@adacore.com> <4C7E96FA.2080209@redhat.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------040707070402020408060109" X-IsSubscribed: yes 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: 2010-09/txt/msg00048.txt.bz2 This is a multi-part message in MIME format. --------------040707070402020408060109 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 431 On 09/01/2010 02:37 PM, Tom Tromey wrote: >>>>>> "Doug" == Doug Evans writes: > > Doug> One would expect the original code to have done a memset too, instead > Doug> of using "static". Presumably it didn't for performance reasons. Do > Doug> we know if the performance concerns were real? > > No, we don't know. > It is safest to just revert to what it was before. > Sounds good to me. Patch attached. Sami --------------040707070402020408060109 Content-Type: text/x-patch; name="hash_regression.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="hash_regression.patch" Content-length: 1042 Fix custom hash regression. 2010-09-01 Sami Wagiaalla * psymtab.c (add_psymbol_to_bcache): Declare psymbol as static. memset psymbol.ginfo.value to 0. diff --git a/gdb/psymtab.c b/gdb/psymtab.c index a5d2f98..24dd301 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1376,7 +1376,15 @@ add_psymbol_to_bcache (char *name, int namelength, int copy_name, enum language language, struct objfile *objfile, int *added) { - struct partial_symbol psymbol; + /* psymbol is static so that there will be no uninitialized gaps in the + structure which might contain random data, causing cache misses in + bcache. */ + static struct partial_symbol psymbol; + + /* However, we must ensure that the entire 'value' field has been + zeroed before assigning to it, because an assignment may not + write the entire field. */ + memset (&psymbol.ginfo.value, 0, sizeof (psymbol.ginfo.value)); /* val and coreaddr are mutually exclusive, one of them *will* be zero */ if (val != 0) --------------040707070402020408060109--