From patchwork Wed Feb 7 16:53:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 85431 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 09B8A385842C for ; Wed, 7 Feb 2024 16:56:01 +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 73F28385801E for ; Wed, 7 Feb 2024 16:54:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 73F28385801E 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 73F28385801E 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=1707324890; cv=none; b=e9/DzHTh2OQ0+fneX/VEtcGS2v5G9KWTuxIMm7GBrTJVPIQlwm7DHck9aBV5FfzGigcLcdlI51l63PlC3dGIPTeFmh2ZCBBzk1Pk2uRCsYsYcRvij9samMai4rXgdpcCh4BuAz9/aQmdqAH/KtsgpjwgEe5syGGk85kiePAaxmU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707324890; c=relaxed/simple; bh=2bN3+8gYHh3n2NXXD37mWUedWCFPfyb0gpG67GDgFNU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=SZjf5FOpbpodmQoUFsos6Dbqci0JWjlFb9lyg1yzI0oN0hN39UjGyW5xwgICqSZ/cd/Cl5Tlp3ZwZeZKV4r46wo7488LIGOmLclzY81BF/VzGZ/C6q3WXWNnuvYrQjn4V8i9GEpOazu7r6+ALbQUSOs4gsdnlUepoq1vXxG37Co= 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 1F2E51E0C2; Wed, 7 Feb 2024 11:54:46 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 1/5] gdb: add program_space parameter to mark_breakpoints_out Date: Wed, 7 Feb 2024 11:53:19 -0500 Message-ID: <20240207165445.117512-2-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: Idc8ed78d23bf3bb2969f6963d8cc049f26901c29 --- gdb/breakpoint.c | 8 ++++---- gdb/breakpoint.h | 5 +++-- gdb/infrun.c | 2 +- gdb/target.c | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 7d1171ec35eb..d844ef7baf25 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -4216,13 +4216,13 @@ remove_breakpoint (struct bp_location *bl) return remove_breakpoint_1 (bl, REMOVE_BREAKPOINT); } -/* Clear the "inserted" flag in all breakpoints. */ +/* See breakpoint.h. */ void -mark_breakpoints_out (void) +mark_breakpoints_out (program_space *pspace) { for (bp_location *bl : all_bp_locations ()) - if (bl->pspace == current_program_space) + if (bl->pspace == pspace) bl->inserted = 0; } @@ -4248,7 +4248,7 @@ breakpoint_init_inferior (enum inf_context context) if (gdbarch_has_global_breakpoints (current_inferior ()->arch ())) return; - mark_breakpoints_out (); + mark_breakpoints_out (pspace); for (breakpoint &b : all_breakpoints_safe ()) { diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 93c49520e8ce..e7bebed2725d 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1764,8 +1764,9 @@ extern void breakpoint_set_inferior (struct breakpoint *b, int inferior); extern void breakpoint_set_task (struct breakpoint *b, int task); -/* Clear the "inserted" flag in all breakpoints. */ -extern void mark_breakpoints_out (void); +/* Clear the "inserted" flag in all breakpoints locations in PSPACE. */ + +extern void mark_breakpoints_out (program_space *pspace); extern struct breakpoint *create_jit_event_breakpoint (struct gdbarch *, CORE_ADDR); diff --git a/gdb/infrun.c b/gdb/infrun.c index 87965fb12742..d00a98906d71 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1247,7 +1247,7 @@ follow_exec (ptid_t ptid, const char *exec_file_target) value that was overwritten with a TRAP instruction). Since we now have a new a.out, those shadow contents aren't valid. */ - mark_breakpoints_out (); + mark_breakpoints_out (current_program_space); /* The target reports the exec event to the main thread, even if some other thread does the exec, and even if the main thread was diff --git a/gdb/target.c b/gdb/target.c index ec75f952ea20..e72e22da69a3 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3628,7 +3628,7 @@ generic_mourn_inferior (void) /* Mark breakpoints uninserted in case something tries to delete a breakpoint while we delete the inferior's threads (which would fail, since the inferior is long gone). */ - mark_breakpoints_out (); + mark_breakpoints_out (inf->pspace); if (inf->pid != 0) exit_inferior (inf);