From patchwork Sat Jan 6 00:26:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 25239 Received: (qmail 5153 invoked by alias); 6 Jan 2018 00:26:29 -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 5108 invoked by uid 89); 6 Jan 2018 00:26:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 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=Unify X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.122) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 06 Jan 2018 00:26:25 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 08903973D69 for ; Fri, 5 Jan 2018 18:26:24 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id XcJceeiZ8uMnyXcJceQv5B; Fri, 05 Jan 2018 18:26:24 -0600 Received: from 71-218-90-63.hlrn.qwest.net ([71.218.90.63]:39986 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eXcJb-0035k1-Qq; Fri, 05 Jan 2018 18:26:23 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 1/6] Unify new_symbol and new_symbol_full Date: Fri, 5 Jan 2018 17:26:16 -0700 Message-Id: <20180106002621.21099-2-tom@tromey.com> In-Reply-To: <20180106002621.21099-1-tom@tromey.com> References: <20180106002621.21099-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1eXcJb-0035k1-Qq X-Source-Sender: 71-218-90-63.hlrn.qwest.net (pokyo.Home) [71.218.90.63]:39986 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This patch unifies new_symbol with new_symbol_full, replacing a wrapper function with a default parameter. 2018-01-05 Tom Tromey * dwarf2read.c (dwarf2_compute_name): Update comment. (read_func_scope, read_variable): Update. (new_symbol): Remove. (new_symbol_full): Rename to new_symbol. --- gdb/ChangeLog | 7 +++++++ gdb/dwarf2read.c | 29 +++++++++-------------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 24ccfe6882..5ad43d963a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2018-01-05 Tom Tromey + + * dwarf2read.c (dwarf2_compute_name): Update comment. + (read_func_scope, read_variable): Update. + (new_symbol): Remove. + (new_symbol_full): Rename to new_symbol. + 2018-01-05 Pedro Alves PR gdb/18653 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index a3028e5c52..92c4903241 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -1862,10 +1862,7 @@ static struct compunit_symtab *dwarf2_start_symtab (struct dwarf2_cu *, CORE_ADDR); static struct symbol *new_symbol (struct die_info *, struct type *, - struct dwarf2_cu *); - -static struct symbol *new_symbol_full (struct die_info *, struct type *, - struct dwarf2_cu *, struct symbol *); + struct dwarf2_cu *, struct symbol * = NULL); static void dwarf2_const_value (const struct attribute *, struct symbol *, struct dwarf2_cu *); @@ -10831,7 +10828,7 @@ dwarf2_compute_name (const char *name, but otherwise compute it by typename_concat inside GDB. FIXME: Actually this is not really true, or at least not always true. It's all very confusing. SYMBOL_SET_NAMES doesn't try to demangle - Fortran names because there is no mangling standard. So new_symbol_full + Fortran names because there is no mangling standard. So new_symbol will set the demangled name to the result of dwarf2_full_name, and it is the demangled name that GDB uses if it exists. */ if (cu->language == language_ada @@ -11104,8 +11101,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu) if (cu->language == language_go) { - /* This is a lie, but we already lie to the caller new_symbol_full. - new_symbol_full assumes we return the mangled name. + /* This is a lie, but we already lie to the caller new_symbol. + new_symbol assumes we return the mangled name. This just undoes that lie until things are cleaned up. */ } else @@ -13731,8 +13728,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) } newobj = push_context (0, lowpc); - newobj->name = new_symbol_full (die, read_type_die (die, cu), cu, - (struct symbol *) templ_func); + newobj->name = new_symbol (die, read_type_die (die, cu), cu, + (struct symbol *) templ_func); /* If there is a location expression for DW_AT_frame_base, record it. */ @@ -14287,7 +14284,7 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu) } } - new_symbol_full (die, NULL, cu, storage); + new_symbol (die, NULL, cu, storage); } /* Call CALLBACK from DW_AT_ranges attribute value OFFSET @@ -21183,8 +21180,8 @@ var_decode_location (struct attribute *attr, struct symbol *sym, NULL, allocate a new symbol on the objfile's obstack. */ static struct symbol * -new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, - struct symbol *space) +new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, + struct symbol *space) { struct objfile *objfile = cu->objfile; struct gdbarch *gdbarch = get_objfile_arch (objfile); @@ -21564,14 +21561,6 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, return (sym); } -/* A wrapper for new_symbol_full that always allocates a new symbol. */ - -static struct symbol * -new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) -{ - return new_symbol_full (die, type, cu, NULL); -} - /* Given an attr with a DW_FORM_dataN value in host byte order, zero-extend it as appropriate for the symbol's type. The DWARF standard (v4) is not entirely clear about the meaning of using