From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2070.outbound.protection.outlook.com [40.107.244.70]) by sourceware.org (Postfix) with ESMTPS id 52E993858002 for ; Fri, 20 May 2022 22:56:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 52E993858002 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=daol/ynuroib9sN0d6ZuvYXgglZbahee54YgiXRLy98IkXXUu2SHiGFqrEu+O5tO0iQzQCxRttJW2ji8JbR8iX0fBcv8Dn6d0kHDhGGXcWlehdYKBgT2D5LDAzIcyxIIlyXbRsRreNHsx4NfJpMsiGugSu9ZbbPEbE4R79N9hmg2+eqyMq+yYr8uZ2MWiGOFnCc+bHoLPCUGzuMPLmnV4NtbvZ3tdXSUlPoC5KDTPtjCoRmi+5VR6bhDNgyj/DDIiA9E4cl2HqR8fvyeT410ei9Qf+VTtmkv3zxKT12g87JX9/YDBBpNWVgnZDmPH10X++bEsXr9V+lSkmnpQ0pvHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hcBQIYXdg58iBVvH+zpWH8DK8ua2W6obkcF3W5Pr/6I=; b=g+uSTGOc4qXDJzPhsJblXAEv7AGXgXG99rAlj7iSnYrVE8yoPatWgjvO/237M6l2kHJ/eu4xLcdNRvqBupCAjGAcR9aVNMk1Hb9r72ExcQu+wknleenG5XsnMbHzV8MzQB9NoWwkQrszdkFCz1r6DhCuikeJ2L/xZujlPQp6pC/6KWpeP6rB04r1wjvOEvqqWhhiKXN3uPB9ru1oTjMLj8QzOwulFgjWw4tMhlKnDaU2a6yXrwDCHoKnp6dFBsAe8gemx37rndEZgV9ILue0xzCtexSssXiUbkycXk2wUCiXhAyoqhrIxzd2iybS5lZq+KbvzkugZZsjzE3hLtPkSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none Received: from BN7PR02CA0001.namprd02.prod.outlook.com (2603:10b6:408:20::14) by DM6PR12MB2603.namprd12.prod.outlook.com (2603:10b6:5:49::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.17; Fri, 20 May 2022 22:55:59 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:20:cafe::cb) by BN7PR02CA0001.outlook.office365.com (2603:10b6:408:20::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16 via Frontend Transport; Fri, 20 May 2022 22:55:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5273.14 via Frontend Transport; Fri, 20 May 2022 22:55:59 +0000 Received: from khazad-dum.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 20 May 2022 17:55:57 -0500 From: Lancelot SIX To: CC: , , Subject: [PATCH v3 2/2] gdb: Change psymbol_functions::require_partial_symbols to partial_symbols Date: Fri, 20 May 2022 23:55:30 +0100 Message-ID: <20220520225530.372343-1-lancelot.six@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0b355b9-5a3b-49e3-0e4d-08da3ab3e804 X-MS-TrafficTypeDiagnostic: DM6PR12MB2603:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nnDQaUnsGyfddE1hbtt0p2EfX9oqLOfFlWiODLh9JCLYaLxHvAH+5uVaJ+PLg87D+/M361w6zanuYZImiEz8oTBS38RuMLaffCs4kDMZUDRVFuwfxLCYmrVIDJhrHS9dLGnnxprijcclAdB5URp7UBC3liz0ZxfCM0gbK7E4gIpREegjfj3xrKdWzEhYrwMADHFWziTubHMNzIJX9aI+vtTPpZfQJMSpla3eS7YxUIH9LdZawWaqV9vZxCxLWaGw2+ZHEFSQpNdgjMKZP1Rs6GjOGQpZkpC3ABhKmbhnxdoolqgabI3Y9KAUDJHYRsfGtbsAw6tUUXbjJP0dmG1LyyE2mgUOE/L38uuK2/hdGeKdWisoxlTHbAbgMeZlAh0vgzUq6jLJaBeORPzqI0jYVbSoy+828p7Sl3GvlWpdQht+ZnH9BMtHhRPbUznE+SIVWPFzMBjLU9hcWR7MsKEYGP/nysguJ3UlIqmVWDKzWIpOUIb1aEEeEvNv7GyxTA84z8Y5l0xvbkynbZ3Uq1Pba3yzpyLDx8rzABg128G7d5Lfh9QW3KTVkemmzttX6E9IaXDUfD5mJ+TarTGhl/D7vBGbXnrPsHLIS+M84TtP9orjIJEWqflsYyiYJSl5uSjdrwVgYKht8AwMatcRIBm1U25k6bEtv2vbe+ZTrI4+XytClz2+61b8DP3MdckATbbsCfa9USOYWTLmBBaBqV8F3W8F7aNTtvrpCxa1iZrhAw3x90ZnPtD4w+pQWBRp0hlX X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(40460700003)(186003)(336012)(7696005)(316002)(82310400005)(54906003)(6916009)(47076005)(426003)(16526019)(86362001)(36756003)(83380400001)(26005)(1076003)(70586007)(70206006)(4326008)(8676002)(6666004)(2616005)(36860700001)(2906002)(356005)(81166007)(8936002)(5660300002)(508600001)(403724002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2022 22:55:59.1858 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0b355b9-5a3b-49e3-0e4d-08da3ab3e804 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2603 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Fri, 20 May 2022 22:56:06 -0000 Hi, Here is an updated (V3) version of the last patch of the series which renames require_partial_symbols into partial_symbols and updates the relevant comments. Best, Lancelot. --- The previous patch ensured that partial symbols are read before calling most of the quick_function's methods. The psymbol_functions class has the require_partial_symbols method which serves this exact purpose, and does not need to do it anymore. This patch renames this method to partial_symbols and makes it an accessor which asserts that partial symbols have been read at this point. Regression tested on x86_64-linux. --- gdb/psympriv.h | 5 ++--- gdb/psymtab.c | 37 +++++++++++++++++-------------------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 677a57edee8..a7ba82a7604 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -553,9 +553,8 @@ struct psymbol_functions : public quick_symbol_functions m_psymbol_map.clear (); } - /* Ensure the partial symbols for OBJFILE have been loaded. Return - a range adapter for the psymtabs. */ - psymtab_storage::partial_symtab_range require_partial_symbols + /* Return a range adapter for the psymtabs. */ + psymtab_storage::partial_symtab_range partial_symbols (struct objfile *objfile); /* Return the partial symbol storage associated with this diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 402d6085fe6..e6c9526cc4f 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -76,15 +76,12 @@ psymtab_storage::install_psymtab (partial_symtab *pst) -/* Ensure that the partial symbols for OBJFILE have been loaded. This - will print a message when symbols are loaded. This function - returns a range adapter suitable for iterating over the psymtabs of - OBJFILE. */ +/* See psympriv.h. */ psymtab_storage::partial_symtab_range -psymbol_functions::require_partial_symbols (struct objfile *objfile) +psymbol_functions::partial_symbols (struct objfile *objfile) { - objfile->require_partial_symbols (true); + gdb_assert ((objfile->flags & OBJF_PSYMTABS_READ) != 0); return m_partial_symtabs->range (); } @@ -236,7 +233,7 @@ psymbol_functions::find_pc_sect_psymtab (struct objfile *objfile, its CUs may be missing in PSYMTABS_ADDRMAP as they may be varying debug info type in single OBJFILE. */ - for (partial_symtab *pst : require_partial_symbols (objfile)) + for (partial_symtab *pst : partial_symbols (objfile)) if (!pst->psymtabs_addrmap_supported && pc >= pst->text_low (objfile) && pc < pst->text_high (objfile)) { @@ -358,7 +355,7 @@ psymbol_functions::lookup_global_symbol_language (struct objfile *objfile, lookup_name_info lookup_name (name, symbol_name_match_type::FULL); - for (partial_symtab *ps : require_partial_symbols (objfile)) + for (partial_symtab *ps : partial_symbols (objfile)) { struct partial_symbol *psym; if (ps->readin_p (objfile)) @@ -607,7 +604,7 @@ psymbol_functions::find_last_source_symtab (struct objfile *ofp) { struct partial_symtab *cs_pst = NULL; - for (partial_symtab *ps : require_partial_symbols (ofp)) + for (partial_symtab *ps : partial_symbols (ofp)) { const char *name = ps->filename; int len = strlen (name); @@ -643,7 +640,7 @@ psymbol_functions::find_last_source_symtab (struct objfile *ofp) void psymbol_functions::forget_cached_source_info (struct objfile *objfile) { - for (partial_symtab *pst : require_partial_symbols (objfile)) + for (partial_symtab *pst : partial_symbols (objfile)) { if (pst->fullname != NULL) { @@ -839,7 +836,7 @@ psymbol_functions::print_stats (struct objfile *objfile, bool print_bcache) n_psyms); i = 0; - for (partial_symtab *ps : require_partial_symbols (objfile)) + for (partial_symtab *ps : partial_symbols (objfile)) { if (!ps->readin_p (objfile)) i++; @@ -884,7 +881,7 @@ psymbol_functions::dump (struct objfile *objfile) void psymbol_functions::expand_all_symtabs (struct objfile *objfile) { - for (partial_symtab *psymtab : require_partial_symbols (objfile)) + for (partial_symtab *psymtab : partial_symbols (objfile)) psymtab_to_symtab (objfile, psymtab); } @@ -897,7 +894,7 @@ psymbol_functions::map_symbol_filenames gdb::function_view fun, bool need_fullname) { - for (partial_symtab *ps : require_partial_symbols (objfile)) + for (partial_symtab *ps : partial_symbols (objfile)) { const char *fullname; @@ -958,7 +955,7 @@ psymbol_functions::expand_matching_symbols int global, symbol_compare_ftype *ordered_compare) { - for (partial_symtab *ps : require_partial_symbols (objfile)) + for (partial_symtab *ps : partial_symbols (objfile)) { QUIT; if (!ps->readin_p (objfile) @@ -1093,7 +1090,7 @@ psymbol_functions::expand_symtabs_matching enum search_domain search) { /* Clear the search flags. */ - for (partial_symtab *ps : require_partial_symbols (objfile)) + for (partial_symtab *ps : partial_symbols (objfile)) ps->searched_flag = PST_NOT_SEARCHED; gdb::optional psym_lookup_name; @@ -1161,7 +1158,7 @@ psymbol_functions::has_symbols (struct objfile *objfile) bool psymbol_functions::has_unexpanded_symtabs (struct objfile *objfile) { - for (partial_symtab *psymtab : require_partial_symbols (objfile)) + for (partial_symtab *psymtab : partial_symbols (objfile)) { /* Is this already expanded? */ if (psymtab->readin_p (objfile)) @@ -1209,7 +1206,7 @@ psymbol_functions::find_compunit_symtab_by_address (struct objfile *objfile, { std::set seen_addrs; - for (partial_symtab *pst : require_partial_symbols (objfile)) + for (partial_symtab *pst : partial_symbols (objfile)) { fill_psymbol_map (objfile, pst, &seen_addrs, @@ -1594,7 +1591,7 @@ maintenance_print_psymbols (const char *args, int from_tty) } else { - for (partial_symtab *ps : psf->require_partial_symbols (objfile)) + for (partial_symtab *ps : psf->partial_symbols (objfile)) { int print_for_source = 0; @@ -1665,7 +1662,7 @@ maintenance_info_psymtabs (const char *regexp, int from_tty) = dynamic_cast (iter.get ()); if (psf == nullptr) continue; - for (partial_symtab *psymtab : psf->require_partial_symbols (objfile)) + for (partial_symtab *psymtab : psf->partial_symbols (objfile)) { QUIT; @@ -1772,7 +1769,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) if (psf == nullptr) continue; - for (partial_symtab *ps : psf->require_partial_symbols (objfile)) + for (partial_symtab *ps : psf->partial_symbols (objfile)) { struct gdbarch *gdbarch = objfile->arch (); -- 2.25.1