From patchwork Tue Oct 10 20:39:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 77441 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 BEEB9385559B for ; Tue, 10 Oct 2023 20:42:31 +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 078A93858D35 for ; Tue, 10 Oct 2023 20:42:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 078A93858D35 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com 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 87D111E0BB; Tue, 10 Oct 2023 16:42:15 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 01/24] gdb: remove empty clear_solib functions Date: Tue, 10 Oct 2023 16:39:56 -0400 Message-ID: <20231010204213.111285-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231010204213.111285-1-simon.marchi@efficios.com> References: <20231010204213.111285-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3496.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, 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 target_so_ops::clear_solib method optional, remove two empty implementations. Change-Id: Ifda297d50c74327d337091c58cdb5b3b60382591 --- gdb/solib-aix.c | 10 +--------- gdb/solib-target.c | 8 +------- gdb/solib.c | 6 ++++-- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index fd6b1e7a4543..0b6ad83eed92 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -373,14 +373,6 @@ solib_aix_free_so (struct so_list *so) delete li; } -/* Implement the "clear_solib" target_so_ops method. */ - -static void -solib_aix_clear_solib (void) -{ - /* Nothing needed. */ -} - /* Compute and return the OBJFILE's section_offset array, using the associated loader info (INFO). */ @@ -715,7 +707,7 @@ const struct target_so_ops solib_aix_so_ops = solib_aix_relocate_section_addresses, solib_aix_free_so, nullptr, - solib_aix_clear_solib, + nullptr, solib_aix_solib_create_inferior_hook, solib_aix_current_sos, solib_aix_open_symbol_file_object, diff --git a/gdb/solib-target.c b/gdb/solib-target.c index ca9478f2ec30..865235de2995 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -281,12 +281,6 @@ solib_target_solib_create_inferior_hook (int from_tty) /* Nothing needed. */ } -static void -solib_target_clear_solib (void) -{ - /* Nothing needed. */ -} - static void solib_target_free_so (struct so_list *so) { @@ -440,7 +434,7 @@ const struct target_so_ops solib_target_so_ops = solib_target_relocate_section_addresses, solib_target_free_so, nullptr, - solib_target_clear_solib, + nullptr, solib_target_solib_create_inferior_hook, solib_target_current_sos, solib_target_open_symbol_file_object, diff --git a/gdb/solib.c b/gdb/solib.c index a2a8a031f343..e8211814283a 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1240,7 +1240,8 @@ clear_solib (void) free_so (so); } - ops->clear_solib (); + if (ops->clear_solib != nullptr) + ops->clear_solib (); } /* Shared library startup support. When GDB starts up the inferior, @@ -1409,7 +1410,8 @@ reload_shared_libraries (const char *ignored, int from_tty, { /* Reset or free private data structures not associated with so_list entries. */ - ops->clear_solib (); + if (ops->clear_solib != nullptr) + ops->clear_solib (); /* Remove any previous solib event breakpoint. This is usually done in common code, at breakpoint_init_inferior time, but