From patchwork Wed Feb 7 16:53:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 85430 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 C9E9E3857C65 for ; Wed, 7 Feb 2024 16:55:36 +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 4FC47385803B for ; Wed, 7 Feb 2024 16:54:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4FC47385803B 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 4FC47385803B 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=XGq289+7JBwH9f7Pne1nChlO3UOIL1gB05SKgUTNxt0E3GKrC5HNrcakZ461x6bQujwgIXUsIHgk8Si7qnWqNPQCPf+DRM+Bpn0qWPMuWIITjbDemRNDSmpmXYr3bNckhy7mV+LPvMKcQlUBq2MyykcyNJeX+M6Oy8R649zDRS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707324892; c=relaxed/simple; bh=9BHx6mqFZYZUkvwgdM5ZVTs/M66wgCAUTDaLMHLYJOU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Q8ar+MQCXtzr581FhRmav1UKmPdKUmihuwObui6dDGuiag+RuotjjnxvP4+OWB/vq3oRZuVk3rL0+7dcFmjUoRd6bwllBGhFjHV+DMkRbo54LRZApKIdB7r2sE+SvyiJpOhUhrUiXPs9zbqDlpq4RUVxq7J9GupV5wIHuZHf9Ow= 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 942AF1E0D0; Wed, 7 Feb 2024 11:54:47 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 3/5] gdb: add program_space parameter to disable_breakpoints_in_shlibs Date: Wed, 7 Feb 2024 11:53:21 -0500 Message-ID: <20240207165445.117512-4-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. Change-Id: Ide917aa306bff1872d961244901d79f65d2da62e --- gdb/breakpoint.c | 7 +++---- gdb/breakpoint.h | 5 ++++- gdb/solib.c | 2 +- gdb/windows-nat.c | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8d8e97400e37..5f05657a8b3e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -7972,11 +7972,10 @@ create_and_insert_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR add return b; } -/* Disable any breakpoints that are on code in shared libraries. Only - apply to enabled breakpoints, disabled ones can just stay disabled. */ +/* See breakpoint.h. */ void -disable_breakpoints_in_shlibs (void) +disable_breakpoints_in_shlibs (program_space *pspace) { for (bp_location *loc : all_bp_locations ()) { @@ -7992,7 +7991,7 @@ disable_breakpoints_in_shlibs (void) || (b->type == bp_jit_event) || (b->type == bp_hardware_breakpoint) || (is_tracepoint (b))) - && loc->pspace == current_program_space + && loc->pspace == pspace && !loc->shlib_disabled && solib_name_from_address (loc->pspace, loc->address) ) diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 8530a7127945..226e4d06993e 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1802,7 +1802,10 @@ extern void remove_solib_event_breakpoints (void); delete at next stop disposition. */ extern void remove_solib_event_breakpoints_at_next_stop (void); -extern void disable_breakpoints_in_shlibs (void); +/* Disable any breakpoints that are on code in shared libraries in PSPACE. + Only apply to enabled breakpoints, disabled ones can just stay disabled. */ + +extern void disable_breakpoints_in_shlibs (program_space *pspace); /* This function returns true if B is a catchpoint. */ diff --git a/gdb/solib.c b/gdb/solib.c index 0a888430cf9b..98cda039a833 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1187,7 +1187,7 @@ clear_solib (void) { const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); - disable_breakpoints_in_shlibs (); + disable_breakpoints_in_shlibs (current_program_space); current_program_space->so_list.clear_and_dispose ([] (solib *so) { notify_solib_unloaded (current_program_space, *so); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 48b0d10d24c7..7f3044fc61de 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1906,7 +1906,7 @@ windows_nat_target::do_initial_windows_stuff (DWORD pid, bool attaching) inf = current_inferior (); if (!inf->target_is_pushed (this)) inf->push_target (this); - disable_breakpoints_in_shlibs (); + disable_breakpoints_in_shlibs (current_program_space); windows_clear_solib (); clear_proceed_status (0); init_wait_for_inferior ();