From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18518 invoked by alias); 9 May 2012 19:05:53 -0000 Received: (qmail 18508 invoked by uid 22791); 9 May 2012 19:05:53 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,TW_BJ X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 May 2012 19:05:38 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3CD6F1C6951; Wed, 9 May 2012 15:05:37 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cLDkJ9zZp8DM; Wed, 9 May 2012 15:05:37 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 0AAA21C6933; Wed, 9 May 2012 15:05:37 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 31B40145616; Wed, 9 May 2012 12:05:29 -0700 (PDT) Date: Wed, 09 May 2012 19:05:00 -0000 From: Joel Brobecker To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: [RFA] choose symbol from given block's objfile first. Message-ID: <20120509190529.GI15555@adacore.com> References: <1336430581-11262-1-git-send-email-brobecker@adacore.com> <874nrqvbeh.fsf@fleche.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874nrqvbeh.fsf@fleche.redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2012-05/txt/msg00304.txt.bz2 [about needing to update the calls to lookup_symbol_aux_quick] > Yes, I think you'd need this change there as well. > > gdb should end up in the lookup_symbol_aux_quick loop if the symbol in > question is in an unexpanded psymtab. In this case you want to be sure > to check the block objfile first. I think I see why I got tricked: Is it because the debug info is DWARF? With DWARF, the lookup_static_symbol_aux first pre-expands all partial symbols containing a match, so we never go into the quick method... Attached are two patches, the first being the code change, and the second a testcase for it. gdb/ChangeLog: * findvar.c (default_read_var_value): For LOC_UNRESOLVED symbols, try locating the symbol in the symbol's own objfile first, before extending the search to all objfiles. * symtab.c (lookup_symbol_aux_objfile): New function, extracted out of lookup_symbol_aux_symtabs. (lookup_symbol_aux_symtabs): Add new parameter "exclude_objfile". Replace extracted-out code by call to lookup_symbol_aux_objfile. Do not search EXCLUDE_OBJFILE. (lookup_static_symbol_aux): Update call to lookup_symbol_aux_symtabs. (lookup_symbol_global): Search for matches in the block's objfile first, before searching all other objfiles. gdb/testsuite/ChangeLog: * gdb.base/ctxobj-f.c, gdb.base/ctxobj-m.c, gdb.base/ctxobj-v.c, gdb.base/ctxobj.exp: New files. Tested on x86_64-linux. No regression. OK to commit? -- Joel