From patchwork Tue Nov 26 21:13:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36248 Received: (qmail 110016 invoked by alias); 26 Nov 2019 21:13:33 -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 109953 invoked by uid 89); 26 Nov 2019 21:13:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Nov 2019 21:13:31 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id A77862227A; Tue, 26 Nov 2019 16:13:29 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 605DE206E6; Tue, 26 Nov 2019 16:13:10 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 5A07628173; Tue, 26 Nov 2019 16:13:09 -0500 (EST) X-Gerrit-PatchSet: 5 Date: Tue, 26 Nov 2019 16:13:09 -0500 From: "Sourceware to Gerrit sync (Code Review)" To: Tom Tromey , gdb-patches@sourceware.org Cc: Pedro Alves , Simon Marchi Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: [pushed] Defer minimal symbol name-setting X-Gerrit-Change-Id: I4fe3993b99fb3a43968067806e294d48e377fd76 X-Gerrit-Change-Number: 166 X-Gerrit-ChangeURL: X-Gerrit-Commit: 5a79c10755d00b71b33b8715e5a665bfd78c9222 In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, simon.marchi@polymtl.ca, tromey@sourceware.org, palves@redhat.com, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191126211309.5A07628173@gnutoolchain-gerrit.osci.io> Sourceware to Gerrit sync has submitted this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/166 ...................................................................... Defer minimal symbol name-setting 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-11-26 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. Change-Id: I4fe3993b99fb3a43968067806e294d48e377fd76 --- M gdb/ChangeLog M gdb/minsyms.c M gdb/symtab.h 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b061e88..dc684be 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2019-11-26 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. + 2019-11-26 Philippe Waroquiers * python/python.c (gdbpy_enter::~gdbpy_enter): Release GIL after diff --git a/gdb/minsyms.c b/gdb/minsyms.c index a9ba66b..6e7021a 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1127,7 +1127,12 @@ 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, copy_name, m_objfile->per_bfd); + + if (copy_name) + msymbol->name = obstack_strndup (&m_objfile->per_bfd->storage_obstack, + name.data (), name.size ()); + else + msymbol->name = name.data (); SET_MSYMBOL_VALUE_ADDRESS (msymbol, address); MSYMBOL_SECTION (msymbol) = section; @@ -1354,6 +1359,17 @@ 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, + false, 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 897ffda..bcbc9c8 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -668,6 +668,10 @@ unsigned maybe_copied : 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. */