From patchwork Wed May 23 04:58:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27426 Received: (qmail 113874 invoked by alias); 23 May 2018 04:59:11 -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 113404 invoked by uid 89); 23 May 2018 04:59:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=arranges X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.198.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 May 2018 04:59:04 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 4FCFE4B63 for ; Tue, 22 May 2018 23:59:02 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id LLrafrohxPvAdLLraf7FFl; Tue, 22 May 2018 23:59:02 -0500 X-Authority-Reason: nr=8 Received: from 174-29-44-154.hlrn.qwest.net ([174.29.44.154]:56108 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fLLra-003S5D-2d; Tue, 22 May 2018 23:59:02 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 12/42] Move within_function to stabsread Date: Tue, 22 May 2018 22:58:21 -0600 Message-Id: <20180523045851.11660-13-tom@tromey.com> In-Reply-To: <20180523045851.11660-1-tom@tromey.com> References: <20180523045851.11660-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fLLra-003S5D-2d X-Source-Sender: 174-29-44-154.hlrn.qwest.net (bapiya.Home) [174.29.44.154]:56108 X-Source-Auth: tom+tromey.com X-Email-Count: 13 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes The global within_function is only used by a few symbol readers. This patch moves the global out of buildsym and into stabsread, which seemed like a better fit. It also arranges for the existing readers to clear the global at the appropriate time. gdb/ChangeLog 2018-05-22 Tom Tromey * stabsread.h (within_function): Move from buildsym.h. * stabsread.c (start_stabs): Clear within_function. * coffread.c (coff_start_symtab): Clear within_function. * buildsym.h (within_function): Move to stabsread.h. * buildsym.c (prepare_for_building): Update. --- gdb/ChangeLog | 8 ++++++++ gdb/buildsym.c | 1 - gdb/buildsym.h | 5 ----- gdb/coffread.c | 1 + gdb/stabsread.c | 1 + gdb/stabsread.h | 5 +++++ 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 0e69865886..10c816efb3 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1036,7 +1036,6 @@ prepare_for_building () { local_symbols = NULL; local_using_directives = NULL; - within_function = 0; context_stack_depth = 0; diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 01d9acc2c9..a6bed3c611 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -150,11 +150,6 @@ EXTERN int context_stack_depth; /* Non-zero if the context stack is empty. */ #define outermost_context_p() (context_stack_depth == 0) -/* Nonzero if within a function (so symbols should be local, if - nothing says specifically). */ - -EXTERN int within_function; - /* The type of the record_line function. */ typedef void (record_line_ftype) (struct subfile *subfile, int line, CORE_ADDR pc); diff --git a/gdb/coffread.c b/gdb/coffread.c index 5c97e7b949..2e5bf9bcab 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -383,6 +383,7 @@ coff_alloc_type (int index) static void coff_start_symtab (struct objfile *objfile, const char *name) { + within_function = 0; start_symtab (objfile, /* We fill in the filename later. start_symtab puts this pointer into last_source_file and we put it in subfiles->name, which diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 13663106dc..bb50a16829 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -4783,6 +4783,7 @@ start_stabs (void) n_this_object_header_files = 1; type_vector_length = 0; type_vector = (struct type **) 0; + within_function = 0; /* FIXME: If common_block_name is not already NULL, we should complain(). */ common_block_name = NULL; diff --git a/gdb/stabsread.h b/gdb/stabsread.h index fdb404a25d..ce254e65d0 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -51,6 +51,11 @@ EXTERN const char *(*next_symbol_text_func) (struct objfile *); EXTERN unsigned char processing_gcc_compilation; +/* Nonzero if within a function (so symbols should be local, if + nothing says specifically). */ + +EXTERN int within_function; + /* Hash table of global symbols whose values are not known yet. They are chained thru the SYMBOL_VALUE_CHAIN, since we don't have the correct data for that slot yet.