From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2607:f138:0:13::2]) by sourceware.org (Postfix) with ESMTPS id DDB7E3850402 for ; Mon, 31 May 2021 16:16:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DDB7E3850402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=jhb@FreeBSD.org Received: from gimli.baldwin.net (c-98-35-218-221.hsd1.ca.comcast.net [98.35.218.221]) by mail.baldwin.cx (Postfix) with ESMTPSA id C234E1A84BC2 for ; Mon, 31 May 2021 12:16:06 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH] Conditionally restore displaced stepping state after fork. Date: Mon, 31 May 2021 09:15:58 -0700 Message-Id: <20210531161558.10600-1-jhb@FreeBSD.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (mail.baldwin.cx [0.0.0.0]); Mon, 31 May 2021 12:16:07 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.103.1 at mail.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KHOP_HELO_FCRDNS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 16:16:12 -0000 There is no default method for gdbarch_displaced_step_restore_all_in_ptid, so calling it unconditionally for fork events triggered an assertion failure on platforms that do not support displaced stepping. To fix, only invoke the method if the gdbarch supports displaced stepping. gdb/ChangeLog: * infrun.c (handle_inferior_event): Only call gdbarch_displaced_step_restore_all_in_ptid if gdbarch_supports_displaced_stepping is true. --- gdb/ChangeLog | 6 ++++++ gdb/infrun.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 03910c0634..b0f448a35e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-05-30 John Baldwin + + * infrun.c (handle_inferior_event): Only call + gdbarch_displaced_step_restore_all_in_ptid if + gdbarch_supports_displaced_stepping is true. + 2021-05-27 Simon Marchi * Fix tab after space indentation issues throughout. diff --git a/gdb/infrun.c b/gdb/infrun.c index e9624d2a9b..6fd077796f 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -5496,7 +5496,8 @@ handle_inferior_event (struct execution_control_state *ecs) /* If this is a fork (child gets its own address space copy) and some displaced step buffers were in use at the time of the fork, restore the displaced step buffer bytes in the child process. */ - if (ecs->ws.kind == TARGET_WAITKIND_FORKED) + if (ecs->ws.kind == TARGET_WAITKIND_FORKED + && gdbarch_supports_displaced_stepping (gdbarch)) gdbarch_displaced_step_restore_all_in_ptid (gdbarch, parent_inf, ecs->ws.value.related_pid); -- 2.31.1