From owner-dev-commits-src-main@freebsd.org Mon May 3 16:20:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F21463694D; Mon, 3 May 2021 16:20:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FYp9n6WWnz3D7j; Mon, 3 May 2021 16:20:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 733F7210D8; Mon, 3 May 2021 16:20:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 143GKjRw022349; Mon, 3 May 2021 16:20:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKjRQ022348; Mon, 3 May 2021 16:20:45 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:45 GMT Message-Id: <202105031620.143GKjRQ022348@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 68d311b66678 - main - ptracestop: mark threads suspended there with the new TDB_SSWITCH flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68d311b66678d9daffc5cf1c78f3101f2eeec3ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:46 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=68d311b66678d9daffc5cf1c78f3101f2eeec3ea commit 68d311b66678d9daffc5cf1c78f3101f2eeec3ea Author: Konstantin Belousov AuthorDate: 2021-04-24 12:02:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:18:25 +0000 ptracestop: mark threads suspended there with the new TDB_SSWITCH flag This way threads in ptracestop can be discovered by debugger Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/kern_sig.c | 2 ++ sys/sys/proc.h | 1 + 2 files changed, 3 insertions(+) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 46b520030dcd..445582a176c8 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2648,7 +2648,9 @@ ptracestop(struct thread *td, int sig, ksiginfo_t *si) td->td_dbgflags &= ~TDB_STOPATFORK; } stopme: + td->td_dbgflags |= TDB_SSWITCH; thread_suspend_switch(td, p); + td->td_dbgflags &= ~TDB_SSWITCH; if (p->p_xthread == td) p->p_xthread = NULL; if (!(p->p_flag & P_TRACED)) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index e02e97d74229..b959681e992b 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -485,6 +485,7 @@ do { \ #define TDB_VFORK 0x00000800 /* vfork indicator for ptrace() */ #define TDB_FSTP 0x00001000 /* The thread is PT_ATTACH leader */ #define TDB_STEP 0x00002000 /* (x86) PSL_T set for PT_STEP */ +#define TDB_SSWITCH 0x00004000 /* Suspended in ptracestop */ /* * "Private" flags kept in td_pflags: