From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.baldwin.cx (unknown [IPv6:2607:f138:0:13::2]) by sourceware.org (Postfix) with ESMTPS id 219653858421 for ; Tue, 1 Mar 2022 00:24:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 219653858421 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=FreeBSD.org Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 856221A84E66 for ; Mon, 28 Feb 2022 19:24:34 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org Subject: [RFC PATCH 11/12] fbsd-nat: Add a low_prepare_to_resume virtual method. Date: Mon, 28 Feb 2022 16:24:18 -0800 Message-Id: <20220301002419.5122-12-jhb@FreeBSD.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220301002419.5122-1-jhb@FreeBSD.org> References: <20220301002419.5122-1-jhb@FreeBSD.org> 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, 28 Feb 2022 19:24:34 -0500 (EST) X-Virus-Scanned: clamav-milter 0.103.1 at mail.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 01 Mar 2022 00:24:36 -0000 This method can be overridden by architecture-specific targets to perform additional work before a thread is resumed. --- gdb/fbsd-nat.c | 9 +++++++-- gdb/fbsd-nat.h | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 2bc7937a38b..934fdbad6ef 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -1138,6 +1138,8 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) perror_with_name (request == PT_RESUME ? ("ptrace (PT_RESUME)") : ("ptrace (PT_SUSPEND)")); + if (request == PT_RESUME) + low_prepare_to_resume (tp); } } else @@ -1145,8 +1147,11 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) /* If ptid is a wildcard, resume all matching threads (they won't run until the process is continued however). */ for (thread_info *tp : all_non_exited_threads (this, ptid)) - if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1) - perror_with_name (("ptrace (PT_RESUME)")); + { + if (ptrace (PT_RESUME, tp->ptid.lwp (), NULL, 0) == -1) + perror_with_name (("ptrace (PT_RESUME)")); + low_prepare_to_resume (tp); + } ptid = inferior_ptid; } diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h index 6028aebfccc..82f7ee47949 100644 --- a/gdb/fbsd-nat.h +++ b/gdb/fbsd-nat.h @@ -119,6 +119,10 @@ class fbsd_nat_target : public inf_ptrace_target virtual void low_delete_thread (thread_info *) {} + /* Hook to call prior to resuming a thread. */ + virtual void low_prepare_to_resume (thread_info *) + {} + protected: void post_startup_inferior (ptid_t) override; -- 2.34.1