From patchwork Wed May 23 04:58:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27427 Received: (qmail 113920 invoked by alias); 23 May 2018 04:59:12 -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 113382 invoked by uid 89); 23 May 2018 04:59:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 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=declares X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.110) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 May 2018 04:59:03 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 9DAE550A4 for ; Tue, 22 May 2018 23:59:01 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id LLrZfPMKfVTw5LLrZfYplw; Tue, 22 May 2018 23:59:01 -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 1fLLrZ-003S5D-D8; Tue, 22 May 2018 23:59:01 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 10/42] Move some code from buildsym to stabsread Date: Tue, 22 May 2018 22:58:19 -0600 Message-Id: <20180523045851.11660-11-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: 1fLLrZ-003S5D-D8 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: 11 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes A few things that currently reside in buildsym.c turn out to be specific to the stabs reader. This patch moves these from buildsym.[ch] to stabsread.[ch]. gdb/ChangeLog 2018-05-22 Tom Tromey * stabsread.h (HASHSIZE, hashname, symnum, next_symbol_text) (next_symbol_text_func): Move from buildsym.h. * stabsread.c (hashname): Move from buildsym.c. * buildsym.h (HASHSIZE, symnum, next_symbol_text) (next_symbol_text_func, hashname): Move to stabsread.h. * buildsym.c: Don't include bcache.h (hashname): Move to stasbread.c. --- gdb/ChangeLog | 10 ++++++++++ gdb/buildsym.c | 10 ---------- gdb/buildsym.h | 15 --------------- gdb/stabsread.c | 13 +++++++++++++ gdb/stabsread.h | 15 +++++++++++++++ 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 85b450383e..0e69865886 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -74,7 +74,6 @@ #include "gdbtypes.h" #include "complaints.h" #include "expression.h" /* For "enum exp_opcode" used by... */ -#include "bcache.h" #include "filenames.h" /* For DOSish file names. */ #include "macrotab.h" #include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */ @@ -1675,15 +1674,6 @@ pop_context (void) -/* Compute a small integer hash code for the given name. */ - -int -hashname (const char *name) -{ - return (hash(name,strlen(name)) % HASHSIZE); -} - - void record_debugformat (const char *format) { diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 191db8ca4f..0b19c39305 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -46,9 +46,6 @@ struct dynamic_prop; #define EXTERN extern #endif -#define HASHSIZE 127 /* Size of things hashed via - hashname(). */ - /* The list of sub-source-files within the current individual compilation. Each file gets its own symtab with its own linetable and associated info, but they all share one blockvector. */ @@ -74,10 +71,6 @@ EXTERN struct subfile *current_subfile; EXTERN unsigned char processing_gcc_compilation; -/* Count symbols as they are processed, for error messages. */ - -EXTERN unsigned int symnum; - /* Record the symbols defined for each context in a list. We don't create a struct block for the context until we know how long to make it. */ @@ -173,12 +166,6 @@ typedef void (record_line_ftype) (struct subfile *subfile, int line, -#define next_symbol_text(objfile) (*next_symbol_text_func)(objfile) - -/* Function to invoke get the next symbol. Return the symbol name. */ - -EXTERN const char *(*next_symbol_text_func) (struct objfile *); - extern void add_symbol_to_list (struct symbol *symbol, struct pending **listhead); @@ -251,8 +238,6 @@ extern struct compunit_symtab *start_symtab (struct objfile *objfile, extern void restart_symtab (struct compunit_symtab *cust, const char *name, CORE_ADDR start_addr); -extern int hashname (const char *name); - extern void free_pending_blocks (void); /* Record the name of the debug format in the current pending symbol diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 4cfefaa3e0..13663106dc 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -44,6 +44,7 @@ #include "target-float.h" #include "cp-abi.h" #include "cp-support.h" +#include "bcache.h" #include /* Ask stabsread.h to define the vars it normally declares `extern'. */ @@ -4839,6 +4840,18 @@ find_name_end (const char *name) } } + + +/* Compute a small integer hash code for the given name. */ + +int +hashname (const char *name) +{ + return hash (name, strlen (name)) % HASHSIZE; +} + + + /* Initializer for this module. */ void diff --git a/gdb/stabsread.h b/gdb/stabsread.h index d24b25dc72..7958990112 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -31,6 +31,21 @@ enum language; #define EXTERN extern #endif +#define HASHSIZE 127 /* Size of things hashed via + hashname(). */ + +extern int hashname (const char *name); + +/* Count symbols as they are processed, for error messages. */ + +EXTERN unsigned int symnum; + +#define next_symbol_text(objfile) (*next_symbol_text_func)(objfile) + +/* Function to invoke get the next symbol. Return the symbol name. */ + +EXTERN const char *(*next_symbol_text_func) (struct objfile *); + /* 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.