From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10436 invoked by alias); 1 Sep 2010 18:09:56 -0000 Received: (qmail 10412 invoked by uid 22791); 1 Sep 2010 18:09:54 -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 18:09:49 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o81I9lPx009835 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 1 Sep 2010 14:09:47 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o81I9lO3031669 for ; Wed, 1 Sep 2010 14:09:47 -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 o81I9kmj011958 for ; Wed, 1 Sep 2010 14:09:46 -0400 Message-ID: <4C7E96FA.2080209@redhat.com> Date: Wed, 01 Sep 2010 18:09: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: 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> In-Reply-To: <20100901164716.GY2986@adacore.com> Content-Type: multipart/mixed; boundary="------------020104010507010306040608" 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/msg00030.txt.bz2 This is a multi-part message in MIME format. --------------020104010507010306040608 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1466 > As far as I can tell, it looks like there is either a memory > corruption somewhere, or we fail to set a field in the psymbol > ginfo. We iterate over all psymbols, and the associated gsym > has an invalid obj_section. > Yup exactly. This part of the patch caused the problem: > /* Helper function, initialises partial symbol structure and stashes > it into objfile's bcache. Note that our caching mechanism will > use all fields of struct partial_symbol to determine hash value of the > @@ -1285,15 +1326,8 @@ add_psymbol_to_bcache (char *name, int namelength, int copy_name, > enum language language, struct objfile *objfile, > int *added) > { > - /* 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; > - I thought this was OK because the new hash function looked only at the initialized fields. Of course this left obj_section uninitialized. Adding: memset (&psymbol, 0, sizeof (psymbol)); seems to fix the problem: Running ../../../gdb/testsuite/gdb.ada/complete.exp ... Running ../../../gdb/testsuite/gdb.stabs/gdb11479.exp ... === gdb Summary === # of expected passes 39 The problem with my testing is that my script did not look for the word ERROR in the log file. The attached patch has been regression tested on F13 gcc 4.4.4... properly :) --------------020104010507010306040608 Content-Type: text/x-patch; name="hash_regression.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="hash_regression.patch" Content-length: 565 Fix custom hash regression. 2010-09-01 Sami Wagiaalla * psymtab.c (add_psymbol_to_bcache): memset psymbol to 0 before initializing individual fields. diff --git a/gdb/psymtab.c b/gdb/psymtab.c index a5d2f98..a8b63f7 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1378,6 +1378,8 @@ add_psymbol_to_bcache (char *name, int namelength, int copy_name, { struct partial_symbol psymbol; + memset (&psymbol, 0, sizeof (psymbol)); + /* val and coreaddr are mutually exclusive, one of them *will* be zero */ if (val != 0) { --------------020104010507010306040608--