From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8WmbMmuTj2luvzkAWB0awg (envelope-from ) for ; Fri, 13 Feb 2026 16:11:07 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=mFOT1JOL; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C77B41E0DD; Fri, 13 Feb 2026 16:11:07 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6EC501E08D for ; Fri, 13 Feb 2026 16:11:06 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 92AC94B9DB70 for ; Fri, 13 Feb 2026 21:11:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92AC94B9DB70 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=mFOT1JOL Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id 113D54B9DB7F for ; Fri, 13 Feb 2026 21:09:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 113D54B9DB7F 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 113D54B9DB7F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771016990; cv=none; b=YLZDt7HVma0qRThmKLoKcXcsYN618Zg4TYiUfsl9mld5eWoadD1303azknL39MryCLxlUWIi9CVwzlh5C8WQ62UoKH5k+cUmFX/9N5Jb1U6rVvua398xI2ZNcsLR9OpcByL/cmCdf6Cj9xISrOATS0dWBUfBrbAwRQh5kpgy3Nc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1771016990; c=relaxed/simple; bh=dmn+fuGqDYl8Y/7bvTEFSyOyNLq01RMi1osJnRAF/JU=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=lc+OFKCQXlB4DRaEh9QQHgC0vRQdoMUgx37nknIL6BGaABNKCgX/kOLK2Q+myDQaL5CmDbvU9x3ePcG2RenScE9lgUkFEoXd623s/Tyd4uCSUMhKpb12OKNZWjuvC8TJE67JIBqvUwFfGEyn1uWAo+S3JDAnu2PHw8+Z5mhXkw4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 113D54B9DB7F Received: from eig-obgw-5002b.ext.cloudfilter.net ([10.0.29.226]) by cmsmtp with ESMTPS id qzP4vKZ93CxrGr0Q9vBllw; Fri, 13 Feb 2026 21:09:49 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id r0Q4vemCQN3K1r0Q4vZCaP; Fri, 13 Feb 2026 21:09:44 +0000 X-Authority-Analysis: v=2.4 cv=UdRRSLSN c=1 sm=1 tr=0 ts=698f931d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=ItBw4LHWJt0A:10 a=iPrBZK46Wi5VAGkTiLIA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To: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=k8H4I3sbMTJpN8eOhaNmH6wi2Igslj9Ytsm7P82IiWc=; b=mFOT1JOL9dipX+6mmrobpAtua+ GfEN07WCNXnhYV1NHGMOhO7pkuiECwqPBk85cV08bpLFIIdB8YOI++fI9iUtckcOLgOAIn3swAS2Q nIJ2RdP8f9JUn2tp/SeuwOK6Q; Received: from 97-118-49-200.hlrn.qwest.net ([97.118.49.200]:47424 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vr0Q4-00000003pCY-0sy7; Fri, 13 Feb 2026 14:09:44 -0700 From: Tom Tromey Date: Fri, 13 Feb 2026 14:09:41 -0700 Subject: [PATCH 1/3] Move entry point functions to program_space MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260213-random-methods-v1-1-59bdac57c3e1@tromey.com> References: <20260213-random-methods-v1-0-59bdac57c3e1@tromey.com> In-Reply-To: <20260213-random-methods-v1-0-59bdac57c3e1@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 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.49.200 X-Source-L: No X-Exim-ID: 1vr0Q4-00000003pCY-0sy7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-118-49-200.hlrn.qwest.net ([192.168.122.1]) [97.118.49.200]:47424 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfJNSi71ylzSwFHLctUBVwbgPyNc146YRzrtVcDvPZJdPZi4+6VqHlfrV1o4By29itGSwnVWMUMxSdYwpVxqk7x6+ZGcKtULzHXgvHKYxEHibjn2Hxn20 aXV6DdjjBp9hTyMDXYYZaA3HFk0m2UbeTEkypEP7McjGBWkwvTNrdvLu6mtaWleyLdfOOJd/j8owRy3mAIvKwXZOGkuxYu10P2A= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This changes a couple of entry-point-related functions to be methods on program_space, and moves them to progspace.c. --- gdb/arc-tdep.c | 2 +- gdb/arch-utils.c | 2 +- gdb/frame.c | 2 +- gdb/infcall.c | 2 +- gdb/objfiles.c | 28 ---------------------------- gdb/objfiles.h | 10 ---------- gdb/progspace.c | 28 ++++++++++++++++++++++++++++ gdb/progspace.h | 8 ++++++++ gdb/solib-frv.c | 2 +- 9 files changed, 41 insertions(+), 43 deletions(-) diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index 48f83dd57c6..99f002341ee 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -861,7 +861,7 @@ arc_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct regcache *regcache) { *real_pc = funaddr; - *bp_addr = entry_point_address (current_program_space); + *bp_addr = current_program_space->entry_point_address (); return sp; } diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index c3ed8f07dc1..9d3dbfa2d81 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -57,7 +57,7 @@ displaced_step_at_entry_point (struct gdbarch *gdbarch) CORE_ADDR addr; int bp_len; - addr = entry_point_address (current_program_space); + addr = current_program_space->entry_point_address (); /* Inferior calls also use the entry point as a breakpoint location. We don't want displaced stepping to interfere with those diff --git a/gdb/frame.c b/gdb/frame.c index 8cb1d0a5c42..bfc85296942 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2677,7 +2677,7 @@ inside_entry_func (const frame_info_ptr &this_frame) { CORE_ADDR entry_point; - if (!entry_point_address_query (current_program_space, &entry_point)) + if (!current_program_space->entry_point_address_query (&entry_point)) return false; return get_frame_func (this_frame) == entry_point; diff --git a/gdb/infcall.c b/gdb/infcall.c index dcbae679d07..51636ff5403 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -1279,7 +1279,7 @@ call_function_by_hand_dummy (struct value *function, CORE_ADDR dummy_addr; real_pc = funaddr; - dummy_addr = entry_point_address (current_program_space); + dummy_addr = current_program_space->entry_point_address (); /* A call dummy always consists of just a single breakpoint, so its address is the same as the address of the dummy. diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 14c07371f15..4f5258e971d 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -284,34 +284,6 @@ objfile::objfile (gdb_bfd_ref_ptr bfd_, program_space *pspace, set_objfile_per_bfd (this); } -/* See objfiles.h. */ - -int -entry_point_address_query (program_space *pspace, CORE_ADDR *entry_p) -{ - objfile *objf = pspace->symfile_object_file; - if (objf == NULL || !objf->per_bfd->ei.entry_point_p) - return 0; - - int idx = objf->per_bfd->ei.the_bfd_section_index; - *entry_p = objf->per_bfd->ei.entry_point + objf->section_offsets[idx]; - - return 1; -} - -/* See objfiles.h. */ - -CORE_ADDR -entry_point_address (program_space *pspace) -{ - CORE_ADDR retval; - - if (!entry_point_address_query (pspace, &retval)) - error (_("Entry point address is not known.")); - - return retval; -} - separate_debug_iterator & separate_debug_iterator::operator++ () { diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 59ad70dfffa..371fd223693 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -904,16 +904,6 @@ obj_section::set_offset (CORE_ADDR offset) /* Declarations for functions defined in objfiles.c */ -/* If there is a valid and known entry point in PSPACE, fill *ENTRY_P with it - and return non-zero. */ - -extern int entry_point_address_query (program_space *pspace, - CORE_ADDR *entry_p); - -/* Get the entry point address in PSPACE. Call error if it is not known. */ - -extern CORE_ADDR entry_point_address (program_space *pspace); - extern void build_objfile_section_table (struct objfile *); extern void free_objfile_separate_debug (struct objfile *); diff --git a/gdb/progspace.c b/gdb/progspace.c index f16c222ec80..bfd7ca5bcb9 100644 --- a/gdb/progspace.c +++ b/gdb/progspace.c @@ -285,6 +285,34 @@ program_space::empty () return find_inferior_for_program_space (this) == nullptr; } +/* See progspace.h. */ + +int +program_space::entry_point_address_query (CORE_ADDR *entry_p) const +{ + objfile *objf = symfile_object_file; + if (objf == NULL || !objf->per_bfd->ei.entry_point_p) + return 0; + + int idx = objf->per_bfd->ei.the_bfd_section_index; + *entry_p = objf->per_bfd->ei.entry_point + objf->section_offsets[idx]; + + return 1; +} + +/* See progspace.h. */ + +CORE_ADDR +program_space::entry_point_address () const +{ + CORE_ADDR retval; + + if (!entry_point_address_query (&retval)) + error (_("Entry point address is not known.")); + + return retval; +} + /* Prints the list of program spaces and their details on UIOUT. If REQUESTED is not -1, it's the ID of the pspace that should be printed. Otherwise, all spaces are printed. */ diff --git a/gdb/progspace.h b/gdb/progspace.h index d013920b0f6..68d5ad35413 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -332,6 +332,14 @@ struct program_space return m_target_sections; } + /* If there is a valid and known entry point in this program space, + fill *ENTRY_P with it and return non-zero. */ + int entry_point_address_query (CORE_ADDR *entry_p) const; + + /* Get the entry point address in this program space. Call error if + it is not known. */ + CORE_ADDR entry_point_address () const; + /* Unique ID number. */ int num = 0; diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 5cf853c4115..4460362a57f 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -697,7 +697,7 @@ enable_break (void) return 0; } - if (!entry_point_address_query (current_program_space, &entry_point)) + if (!current_program_space->entry_point_address_query (&entry_point)) { solib_debug_printf ("Symbol file has no entry point."); return 0; -- 2.49.0