From patchwork Sat Nov 1 05:32:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 3538 Received: (qmail 13900 invoked by alias); 1 Nov 2014 05:33:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 13890 invoked by uid 89); 1 Nov 2014 05:33:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f174.google.com Received: from mail-pd0-f174.google.com (HELO mail-pd0-f174.google.com) (209.85.192.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 01 Nov 2014 05:33:01 +0000 Received: by mail-pd0-f174.google.com with SMTP id p10so8430620pdj.19 for ; Fri, 31 Oct 2014 22:32:59 -0700 (PDT) X-Received: by 10.70.15.228 with SMTP id a4mr29466451pdd.77.1414819979021; Fri, 31 Oct 2014 22:32:59 -0700 (PDT) Received: from sspiff.org (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by mx.google.com with ESMTPSA id ev8sm11449651pdb.28.2014.10.31.22.32.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Oct 2014 22:32:58 -0700 (PDT) Received: by sspiff.org (sSMTP sendmail emulation); Fri, 31 Oct 2014 22:32:06 -0700 From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH] Use ALL_PRIMARY_SYMTABS instead of ALL_SYMTABS. Date: Fri, 31 Oct 2014 22:32:06 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. I noticed a couple of users of ALL_SYMTABS when what they really want to use is ALL_PRIMARY_SYMTABS. Non-primary symtabs share the blockvector of their primary symtab. 2014-10-31 Doug Evans * ada-lang.c (ada_make_symbol_completion_list): Use ALL_PRIMARY_SYMTABS instead of ALL_SYMTABS. * symtab.c (lookup_objfile_from_block): Ditto. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 5793cd2..4320eec 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -6212,9 +6212,11 @@ ada_make_symbol_completion_list (const char *text0, const char *word, } /* Go through the symtabs and check the externs and statics for - symbols which match. */ + symbols which match. + Non-primary symtabs share the block vector with their primary symtabs + so we use ALL_PRIMARY_SYMTABS here instead of ALL_SYMTABS. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); @@ -6226,7 +6228,7 @@ ada_make_symbol_completion_list (const char *text0, const char *word, } } - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); diff --git a/gdb/symtab.c b/gdb/symtab.c index ed164f7..6dd4910 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1549,8 +1549,10 @@ lookup_objfile_from_block (const struct block *block) return NULL; block = block_global_block (block); - /* Go through SYMTABS. */ - ALL_SYMTABS (obj, s) + /* Go through SYMTABS. + Non-primary symtabs share the block vector with their primary symtabs + so we use ALL_PRIMARY_SYMTABS here instead of ALL_SYMTABS. */ + ALL_PRIMARY_SYMTABS (obj, s) if (block == BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK)) { if (obj->separate_debug_objfile_backlink)