Adjust OpenBSD code to set the process state to be less wrong ##debug

Use the p_stat of the main thread to decide in which state the process is.
For multi-threaded applications this is still not quite correct but at
least this compiles on OpenBSD-current.

See also 290aac5691
This commit is contained in:
Claudio Jeker 2024-07-27 08:02:11 +02:00 committed by GitHub
parent f6585839ee
commit cdf4e18dd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -189,18 +189,20 @@ RDebugInfo *bsd_info(RDebug *dbg, const char *arg) {
rdi->gid = kp->p__pgid;
rdi->exe = strdup (kp->p_comm);
rdi->status = R_DBG_PROC_STOP;
if (kp->p_psflags & PS_ZOMBIE) {
rdi->status = R_DBG_PROC_ZOMBIE;
} else if (kp->p_psflags & PS_STOPPED) {
switch (kp->p_stat) {
case SDEAD:
rdi->status = R_DBG_PROC_DEAD;
break;
case SSTOP:
rdi->status = R_DBG_PROC_STOP;
} else if (kp->p_psflags & PS_PPWAIT) {
break;
case SSLEEP:
rdi->status = R_DBG_PROC_SLEEP;
} else if ((kp->p_psflags & PS_EXEC) || (kp->p_psflags & PS_INEXEC)) {
break;
default:
rdi->status = R_DBG_PROC_RUN;
break;
}
}
kvm_close (kd);