From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64642 invoked by alias); 18 May 2019 21:00:35 -0000 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 Received: (qmail 60346 invoked by uid 89); 18 May 2019 21:00:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-13.5 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.1 spammy=contents X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.228) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 18 May 2019 21:00:24 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 69FCD1D8C7 for ; Sat, 18 May 2019 16:00:13 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id S6RBhP2V12PzOS6RBhoGu1; Sat, 18 May 2019 16:00:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+buXT4LcgWRx194ngqDjJo8ehz5PvbFfzuSLk9TVv/w=; b=MbUhC7KM/WzFDzfggCmXEoZ8er AQsw22C5QfOToB5yp2WR/xzpDXXjT1Li0Kbzl/8RywC0PZuCIIf7ey2ntZELtTc3r4ce7CEP1K4fg UM/Y+KKfph57XwW/daEL7CE2+; Received: from 71-218-69-43.hlrn.qwest.net ([71.218.69.43]:38158 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1hS6RB-0016Ya-7H; Sat, 18 May 2019 16:00:13 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH v2 1/8] Defer minimal symbol name-setting Date: Sat, 18 May 2019 21:00:00 -0000 Message-Id: <20190518210010.27697-2-tom@tromey.com> In-Reply-To: <20190518210010.27697-1-tom@tromey.com> References: <20190518210010.27697-1-tom@tromey.com> X-SW-Source: 2019-05/txt/msg00452.txt.bz2 Currently the demangled name of a minimal symbol is set when creating the symbol. However, there is no intrinsic need to do this. This patch instead arranges for the demangling to be done just before the minsym hash tables are filled. This will be useful in a later patch. gdb/ChangeLog 2019-05-18 Tom Tromey * symtab.h (struct minimal_symbol) : New member. * minsyms.c (minimal_symbol_reader::record_full): Copy name. Don't call symbol_set_names. (minimal_symbol_reader::install): Call symbol_set_names. --- gdb/ChangeLog | 7 +++++++ gdb/minsyms.c | 18 +++++++++++++++++- gdb/symtab.h | 4 ++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 9d29d880aab..488201a1886 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1140,7 +1140,11 @@ minimal_symbol_reader::record_full (const char *name, int name_len, msymbol = &m_msym_bunch->contents[m_msym_bunch_index]; symbol_set_language (msymbol, language_auto, &m_objfile->per_bfd->storage_obstack); - symbol_set_names (msymbol, name, name_len, copy_name, m_objfile->per_bfd); + + if (copy_name) + name = (char *) obstack_copy0 (&m_objfile->per_bfd->storage_obstack, + name, name_len); + msymbol->name = name; SET_MSYMBOL_VALUE_ADDRESS (msymbol, address); MSYMBOL_SECTION (msymbol) = section; @@ -1367,6 +1371,18 @@ minimal_symbol_reader::install () m_objfile->per_bfd->minimal_symbol_count = mcount; m_objfile->per_bfd->msymbols = std::move (msym_holder); + msymbols = m_objfile->per_bfd->msymbols.get (); + for (int i = 0; i < mcount; ++i) + { + if (!msymbols[i].name_set) + { + symbol_set_names (&msymbols[i], msymbols[i].name, + strlen (msymbols[i].name), 0, + m_objfile->per_bfd); + msymbols[i].name_set = 1; + } + } + build_minimal_symbol_hash_tables (m_objfile); } } diff --git a/gdb/symtab.h b/gdb/symtab.h index e4ee7271a15..cb06fe01c59 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -669,6 +669,10 @@ struct minimal_symbol : public general_symbol_info the object file format may not carry that piece of information. */ unsigned int has_size : 1; + /* Non-zero if this symbol ever had its demangled name set (even if + it was set to NULL). */ + unsigned int name_set : 1; + /* Minimal symbols with the same hash key are kept on a linked list. This is the link. */ -- 2.17.2