From patchwork Wed Feb 7 16:53:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 85432 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 39C443858025 for ; Wed, 7 Feb 2024 16:56:17 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 765E13858009 for ; Wed, 7 Feb 2024 16:54:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 765E13858009 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 765E13858009 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707324892; cv=none; b=r2RNszuqpVQDzUm00gCqhiBEk1XFX8ao5T2ihs0/A4Y3mb91zPpVNaE46/5IrC5/Cvb8nP6NyPXd65q8ts1Vui9+Erejn1svoSL/UrjsBXA4MWBwOmFzcsKa9zACqHWFTUEGJOi0ZcB6RcajYRcfViupoFN3gteWNip1nd/FpZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707324892; c=relaxed/simple; bh=MjfgzcTYdyG4Sk/iOG18t97AFac8uDUiqn3o0D19JZs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=PhqUDKi6tlcYVbcEmEUh37LsIwAU5pS77DYCPUTZ/tI0xxys1un8V97Pu+bjGikoiuzKNAUfhqXK7ibCIHEm2w7qqxpPWJesVi011aUsDfyDCwyOvvN/rTfEHQjL1pUZ94BI1mcciCyX76R02rqWojpsAMlj6TnilXRvA8MXYy4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (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 008881E110; Wed, 7 Feb 2024 11:54:47 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 4/5] gdb: add program_space parameter to clear_solib Date: Wed, 7 Feb 2024 11:53:22 -0500 Message-ID: <20240207165445.117512-5-simon.marchi@efficios.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207165445.117512-1-simon.marchi@efficios.com> References: <20240207165445.117512-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3496.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, 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.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 reference bubble up one level. Remove one unnecessary declaration of clear_solib. Change-Id: I234e2c8c0b71713364fc7b76cee2bee2b026bd6d --- gdb/corelow.c | 2 +- gdb/solib.c | 16 ++++++++-------- gdb/solib.h | 6 +++--- gdb/symtab.h | 4 ---- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/gdb/corelow.c b/gdb/corelow.c index 43c1f69b1317..f291b2aba191 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -335,7 +335,7 @@ core_target::clear_core () /* Clear out solib state while the bfd is still open. See comments in clear_solib in solib.c. */ - clear_solib (); + clear_solib (current_program_space); current_program_space->cbfd.reset (nullptr); } diff --git a/gdb/solib.c b/gdb/solib.c index 98cda039a833..991ff156d12f 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1180,23 +1180,23 @@ solib_keep_data_in_core (CORE_ADDR vaddr, unsigned long size) return false; } -/* Called by free_all_symtabs */ +/* See solib.h. */ void -clear_solib (void) +clear_solib (program_space *pspace) { const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); - disable_breakpoints_in_shlibs (current_program_space); + disable_breakpoints_in_shlibs (pspace); - current_program_space->so_list.clear_and_dispose ([] (solib *so) { - notify_solib_unloaded (current_program_space, *so); - current_program_space->remove_target_sections (so); + pspace->so_list.clear_and_dispose ([pspace] (solib *so) { + notify_solib_unloaded (pspace, *so); + pspace->remove_target_sections (so); delete so; }); if (ops->clear_solib != nullptr) - ops->clear_solib (current_program_space); + ops->clear_solib (pspace); } /* Shared library startup support. When GDB starts up the inferior, @@ -1244,7 +1244,7 @@ no_shared_libraries (const char *ignored, int from_tty) access to their associated objfiles. Therefore, we can not purge the solibs' objfiles before clear_solib has been called. */ - clear_solib (); + clear_solib (current_program_space); objfile_purge_solibs (); } diff --git a/gdb/solib.h b/gdb/solib.h index 69183278318b..f7a93c0718f0 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -42,10 +42,10 @@ extern bool debug_solib; #define SOLIB_SCOPED_DEBUG_START_END(fmt, ...) \ scoped_debug_start_end (debug_solib, "solib", fmt, ##__VA_ARGS__) -/* Called when we free all symtabs, to free the shared library information - as well. */ +/* Called when we free all symtabs of PSPACE, to free the shared library + information as well. */ -extern void clear_solib (void); +extern void clear_solib (program_space *pspace); /* Called to add symbols from a shared library to gdb's symbol table. */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 3b067a77b3c8..ca5a5b0f7fde 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2423,10 +2423,6 @@ extern bool find_line_pc_range (struct symtab_and_line, CORE_ADDR *, extern void resolve_sal_pc (struct symtab_and_line *); -/* solib.c */ - -extern void clear_solib (void); - /* The reason we're calling into a completion match list collector function. */ enum class complete_symbol_mode