git: 4f32b298c679 - main - sig_handle_first_stop(): notify debugger

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 27 Apr 2025 21:52:51 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f32b298c679271243855083d20306563f815f17

commit 4f32b298c679271243855083d20306563f815f17
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-04-22 23:15:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-04-27 21:52:32 +0000

    sig_handle_first_stop(): notify debugger
    
    Since it could be that no debuggee threads are waken up because all of
    them are in interruptible sleep and consequently all were suspended
    remotely, call thread_stopped().
    
    Tested by:      pho
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D49984
---
 sys/kern/kern_sig.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index dd2d4d3ab401..4637a1218bf1 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -2868,7 +2868,8 @@ sig_handle_first_stop(struct thread *td, struct proc *p, int sig)
 
 	p->p_flag2 &= ~P2_PTRACE_FSTP;
 	p->p_flag |= P_STOPPED_SIG | P_STOPPED_TRACE;
-	sig_suspend_threads(td, p);
+	if (sig_suspend_threads(td, p) && td == NULL)
+		thread_stopped(p);
 }
 
 /*