From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 30DDB384CBAF for ; Thu, 23 Nov 2023 05:32:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 30DDB384CBAF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 30DDB384CBAF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700717528; cv=none; b=xKkdo4u47vuHDo3s5hPkL3ZGUSDOG9Ax0qnCdcf+G4VPZOPcNrqItO5xNlGoItFcSNeCS32MtovRBGt4kqPVFFjs+QW25eB6UpynaPgq71ih23bwPBWYiLlJ6z6w2cuyBcY1Ewb62A60Joi1xc49NTWoPfAiGFbPxHFqMTpMIqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700717528; c=relaxed/simple; bh=Xs+AIvl6AYjMwQmjRJE34/56Sk3YLgqjRJeiFPiwkYQ=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=Xve9avr0EHfJt/ZzY84JZEIIxDroT0VJzr7g3wMBRlv8Ox60qmQGw1SnxYkaiuhL/KrRs3QKGWukDzEWdVLhz0y/Phxf1iJIfPE8Ad0Na6W5XJg4elFgsP1+MUmBsSwbBTUeNuNpn56KZ8vXrIoSpVwfy+XPEJk2hA7ETcS7sDQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6010a.ext.cloudfilter.net ([10.0.30.248]) by cmsmtp with ESMTPS id 5xOTrrcVOhqFd62Jorypau; Thu, 23 Nov 2023 05:32:04 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 62Jnr2PUF8vT062JnrqohU; Thu, 23 Nov 2023 05:32:03 +0000 X-Authority-Analysis: v=2.4 cv=ffi+dmcF c=1 sm=1 tr=0 ts=655ee3d3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=NCcGvFC-7IuRexjrVQYA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=QY9Qc71DfpvHPVfHB3lqWosMbCkhadA48bQGQlZzEXc=; b=BJdcwQYxTq+qVD8BbWySsNZo4K bwOPKyOwWKLabBbmUgBs3NBpG1ap2J7ztfyEkzuN/ruaMRMk3InSfT/TNyuTYDGlx2I20Kmca25gb sW68jw2kpIPJKuiadek5oF/Vc; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:46354 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r62Jm-003TGR-37 for gdb-patches@sourceware.org; Wed, 22 Nov 2023 22:32:02 -0700 From: Tom Tromey Date: Wed, 22 Nov 2023 22:32:15 -0700 Subject: [PATCH v3 06/18] Add quick_symbol_functions::compute_main_name MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231122-t-bg-dwarf-reading-v3-6-fc3180de63c4@tromey.com> References: <20231122-t-bg-dwarf-reading-v3-0-fc3180de63c4@tromey.com> In-Reply-To: <20231122-t-bg-dwarf-reading-v3-0-fc3180de63c4@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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.122.77.73 X-Source-L: No X-Exim-ID: 1r62Jm-003TGR-37 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:46354 X-Source-Auth: tom+tromey.com X-Email-Count: 8 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHJZSLnw61hO4y18UkYOGWENFmtOK442y2z0P6v64yU7WXyjTXRWmPZ6nAPd+YfwYP950ClaXGo7Hj/3a1sguAHrIL+ktidJAjp4ApDEsPWpPwncHeLn lKAfaV2jEIuvaMr+CAZn5Q8XT4CMwLwCg9hWmKjHVylRCQnDxtzZa/4aQ5WnmdofS5CafI3EraKKshnRXASV14JqxwtFJ734bHA= X-Spam-Status: No, score=-3024.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,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 List-Id: This adds a new compute_main_name method to quick_symbol_functions. Currently there are no implementations of this, but a subsequent patch will add one. --- gdb/objfiles.h | 3 +++ gdb/quick-symbol.h | 9 +++++++++ gdb/symfile-debug.c | 12 ++++++++++++ gdb/symtab.c | 2 ++ 4 files changed, 26 insertions(+) diff --git a/gdb/objfiles.h b/gdb/objfiles.h index ec9d354e4a7..63f5db82cfa 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -611,6 +611,9 @@ struct objfile void map_symbol_filenames (gdb::function_view fun, bool need_fullname); + /* See quick_symbol_functions. */ + void compute_main_name (); + /* See quick_symbol_functions. */ struct compunit_symtab *find_compunit_symtab_by_address (CORE_ADDR address); diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h index a7fea2ccb49..49505aef64a 100644 --- a/gdb/quick-symbol.h +++ b/gdb/quick-symbol.h @@ -212,6 +212,15 @@ struct quick_symbol_functions gdb::function_view fun, bool need_fullname) = 0; + /* Compute the name and language of the main function for the given + objfile. Normally this is done during symbol reading, but this + method exists in case this work is done in a worker thread and + must be waited for. The implementation can call + set_objfile_main_name if results are found. */ + virtual void compute_main_name (struct objfile *objfile) + { + } + /* Return true if this class can lazily read the symbols. This may only return true if there are in fact symbols to be read, because this is used in the implementation of 'has_partial_symbols'. */ diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 85c43719dee..ea9d0c47ba5 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -485,6 +485,18 @@ objfile::map_symbol_filenames (gdb::function_view fun, iter->map_symbol_filenames (this, fun, need_fullname); } +void +objfile::compute_main_name () +{ + if (debug_symfile) + gdb_printf (gdb_stdlog, + "qf->compute_main_name (%s)\n", + objfile_debug_name (this)); + + for (const auto &iter : qf_require_partial_symbols ()) + iter->compute_main_name (this); +} + struct compunit_symtab * objfile::find_compunit_symtab_by_address (CORE_ADDR address) { diff --git a/gdb/symtab.c b/gdb/symtab.c index 15471554f32..68836efa08b 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -6237,6 +6237,8 @@ find_main_name (void) accurate. */ for (objfile *objfile : current_program_space->objfiles ()) { + objfile->compute_main_name (); + if (objfile->per_bfd->name_of_main != NULL) { set_main_name (pspace, -- 2.41.0