From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway22.websitewelcome.com (gateway22.websitewelcome.com [192.185.47.65]) by sourceware.org (Postfix) with ESMTPS id DA5593877009 for ; Wed, 25 Mar 2020 20:07:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DA5593877009 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 62594FF82 for ; Wed, 25 Mar 2020 15:07:18 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id HCJ4jdsHeVQh0HCJ4jrpJe; Wed, 25 Mar 2020 15:07:18 -0500 X-Authority-Reason: nr=8 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=wbp7pbgEtL+F/AEVxS686I5cnIdz5XkbXjXg8+wmCMQ=; b=KJbr/MU4r6p9AYhXKDz1wghuf8 y4GRNA8N5nFzaBLLUVKUNbE5BpF4M/aktj4EYjoBqRrJE6cS+ego6YmfvmpvqcjKwQNtQh/IM0nmu 7NTmVcs7EkdvFCg6ZmpyKA2Lg; Received: from 97-118-117-21.hlrn.qwest.net ([97.118.117.21]:38026 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jHCJ4-001VYp-5c; Wed, 25 Mar 2020 14:07:18 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 05/10] Introduce new add_psymbol_to_list overload Date: Wed, 25 Mar 2020 14:07:10 -0600 Message-Id: <20200325200715.12947-6-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200325200715.12947-1-tom@tromey.com> References: <20200325200715.12947-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.118.117.21 X-Source-L: No X-Exim-ID: 1jHCJ4-001VYp-5c X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-117-21.hlrn.qwest.net (bapiya.Home) [97.118.117.21]:38026 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-24.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, JMQ_SPF_NEUTRAL, RCVD_IN_ABUSEAT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2020 20:07:20 -0000 This adds a new overload of add_psymbol_to_list. This one takes an already constructed psymbol and adds it to the bcache and the appropriate list. This seemed cleaner than continuing to add parameters to the existing add_psymbol_to_list, and is more in line with how full symbols are constructed. gdb/ChangeLog 2020-03-25 Tom Tromey * psymtab.c (add_psymbol_to_bcache): Simplify calling convention. (add_psymbol_to_list): New overload. Make old overload call new one. * psympriv.h (add_psymbol_to_list): New overload. --- gdb/ChangeLog | 7 +++++++ gdb/psympriv.h | 8 ++++++++ gdb/psymtab.c | 53 +++++++++++++++++++++++++++----------------------- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 0effedc4ec2..cf3f43f0e01 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -414,6 +414,14 @@ extern void add_psymbol_to_list (gdb::string_view name, enum language language, struct objfile *objfile); +/* Add a symbol to the partial symbol table of OBJFILE. The psymbol + must be fully constructed, and the names must be set and intern'd + as appropriate. */ + +extern void add_psymbol_to_list (const partial_symbol &psym, + psymbol_placement where, + struct objfile *objfile); + /* Initialize storage for partial symbols. If partial symbol storage has already been initialized, this does nothing. TOTAL_SYMBOLS is an estimate of how many symbols there will be. */ diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 8aa9c6e87bb..36321856368 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1588,24 +1588,10 @@ psymbol_compare (const void *addr1, const void *addr2, int length) different domain (or address) is possible and correct. */ static struct partial_symbol * -add_psymbol_to_bcache (gdb::string_view name, bool copy_name, - domain_enum domain, - enum address_class theclass, - short section, - CORE_ADDR coreaddr, - enum language language, struct objfile *objfile, +add_psymbol_to_bcache (const partial_symbol &psymbol, + struct objfile *objfile, int *added) { - struct partial_symbol psymbol; - memset (&psymbol, 0, sizeof (psymbol)); - - psymbol.set_unrelocated_address (coreaddr); - psymbol.ginfo.section = section; - psymbol.domain = domain; - psymbol.aclass = theclass; - psymbol.ginfo.set_language (language, objfile->partial_symtabs->obstack ()); - psymbol.ginfo.compute_and_set_names (name, copy_name, objfile->per_bfd); - /* Stash the partial symbol away in the cache. */ return ((struct partial_symbol *) objfile->partial_symtabs->psymbol_cache.insert @@ -1626,21 +1612,16 @@ append_psymbol_to_list (std::vector *list, /* See psympriv.h. */ void -add_psymbol_to_list (gdb::string_view name, bool copy_name, - domain_enum domain, - enum address_class theclass, - short section, +add_psymbol_to_list (const partial_symbol &psymbol, psymbol_placement where, - CORE_ADDR coreaddr, - enum language language, struct objfile *objfile) + struct objfile *objfile) { struct partial_symbol *psym; int added; /* Stash the partial symbol away in the cache. */ - psym = add_psymbol_to_bcache (name, copy_name, domain, theclass, - section, coreaddr, language, objfile, &added); + psym = add_psymbol_to_bcache (psymbol, objfile, &added); /* Do not duplicate global partial symbols. */ if (where == psymbol_placement::GLOBAL && !added) @@ -1656,6 +1637,30 @@ add_psymbol_to_list (gdb::string_view name, bool copy_name, /* See psympriv.h. */ +void +add_psymbol_to_list (gdb::string_view name, bool copy_name, + domain_enum domain, + enum address_class theclass, + short section, + psymbol_placement where, + CORE_ADDR coreaddr, + enum language language, struct objfile *objfile) +{ + struct partial_symbol psymbol; + memset (&psymbol, 0, sizeof (psymbol)); + + psymbol.set_unrelocated_address (coreaddr); + psymbol.ginfo.section = section; + psymbol.domain = domain; + psymbol.aclass = theclass; + psymbol.ginfo.set_language (language, objfile->partial_symtabs->obstack ()); + psymbol.ginfo.compute_and_set_names (name, copy_name, objfile->per_bfd); + + add_psymbol_to_list (psymbol, where, objfile); +} + +/* See psympriv.h. */ + void init_psymbol_list (struct objfile *objfile, int total_symbols) { -- 2.17.2