From patchwork Thu Jul 11 19:52:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 93758 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4815D3875DEC for ; Thu, 11 Jul 2024 19:55:52 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id B389F3875462 for ; Thu, 11 Jul 2024 19:55:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B389F3875462 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B389F3875462 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720727718; cv=none; b=BaWW14jwKQVjRdNbTsOJgyDoYcpODh8Hc+O0kxX8no2sizsbDnT0DOCVvIeVKGkdpJupZt+OLRNt7L+ExGwz8j7qeL2F89ZEb/LCAv0NGDeGNSmV1lq4H5Xr88l144jVdvYbLRNDxsxU09qiS8ScIgyfP7qJOw+rVVsrQrn5sh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720727718; c=relaxed/simple; bh=+RZVy5YdUEa9RvZchyJ74Ph71Ffpz4PGD11wiYYtveY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=NuwzzKeAdlySa5nPpG2ypGOzWH3bukbsanF8mpkz5bTF+H/1sylOnNu4jhZwJgwLwqHOHEvq0i5xJLLCB87TCxMlywJqmjM87BEgQhzUzWoWv/5kdC6xAYbdHh8f28CpnN35Gsu45DQJPs8qYHNZqzCnXqHfTGpgnfyipAX9FSY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 46BJtBiv001831 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jul 2024 15:55:15 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 46BJtBiv001831 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1720727716; bh=ysfGlrQusHMFj4CifO9SDEkURzwuYP+7zgnwfGOYz3M=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=gCe8G6M2CDIQl9EvBw1ZiLYHgrkIX2c344KwdE1OexY7w7IoeVu8A2QuxRgPHL+sX uy68KM8BjURKaDjZjX7JNKB9k7kL5b10opDvSwvnowYWBZVZWPVBodwYLW5zoIlcZM eRcEPA2NEe8ryDeNu7r7N5PDlWfkHon+h05TmkRY= Received: from simark.localdomain (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (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 ESMTPSA id D2D2F1E0D0; Thu, 11 Jul 2024 15:55:10 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 11/14] gdb: pass program space to entry_point_address_query Date: Thu, 11 Jul 2024 15:52:07 -0400 Message-ID: <20240711195307.1544451-12-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240711195307.1544451-1-simon.marchi@polymtl.ca> References: <20240711195307.1544451-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 11 Jul 2024 19:55:11 +0000 X-Spam-Status: No, score=-3188.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Make the current program space bubble up one level. Change-Id: Ic3ad0869ca1afe41854f605a6f7eb092fca29ff8 --- gdb/frame.c | 2 +- gdb/objfiles.c | 9 ++++----- gdb/objfiles.h | 6 +++++- gdb/solib-frv.c | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gdb/frame.c b/gdb/frame.c index 43efac07d95a..e6ab54797a8e 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2628,7 +2628,7 @@ inside_entry_func (const frame_info_ptr &this_frame) { CORE_ADDR entry_point; - if (!entry_point_address_query (&entry_point)) + if (!entry_point_address_query (current_program_space, &entry_point)) return false; return get_frame_func (this_frame) == entry_point; diff --git a/gdb/objfiles.c b/gdb/objfiles.c index f1569c35c10d..2a2fbd3ef01b 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -345,13 +345,12 @@ objfile::objfile (gdb_bfd_ref_ptr bfd_, const char *name, objfile_flags flags_) set_objfile_per_bfd (this); } -/* If there is a valid and known entry point, function fills *ENTRY_P with it - and returns non-zero; otherwise it returns zero. */ +/* See objfiles.h. */ int -entry_point_address_query (CORE_ADDR *entry_p) +entry_point_address_query (program_space *pspace, CORE_ADDR *entry_p) { - objfile *objf = current_program_space->symfile_object_file; + objfile *objf = pspace->symfile_object_file; if (objf == NULL || !objf->per_bfd->ei.entry_point_p) return 0; @@ -368,7 +367,7 @@ entry_point_address (void) { CORE_ADDR retval; - if (!entry_point_address_query (&retval)) + if (!entry_point_address_query (current_program_space, &retval)) error (_("Entry point address is not known.")); return retval; diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 1e04704c68fd..199dea0a9ba4 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -907,7 +907,11 @@ obj_section::set_offset (CORE_ADDR offset) /* Declarations for functions defined in objfiles.c */ -extern int entry_point_address_query (CORE_ADDR *entry_p); +/* 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); extern CORE_ADDR entry_point_address (void); diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 39508fab4c83..79052db86f82 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -687,7 +687,7 @@ enable_break (void) return 0; } - if (!entry_point_address_query (&entry_point)) + if (!entry_point_address_query (current_program_space, &entry_point)) { solib_debug_printf ("Symbol file has no entry point."); return 0;