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
This commit is contained in:
Konstantin Belousov 2021-04-24 15:02:40 +03:00
parent 9ebf9100ba
commit 68d311b666
2 changed files with 3 additions and 0 deletions

View File

@ -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))

View File

@ -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: