diff options
author | bde <bde@FreeBSD.org> | 2002-08-31 04:25:44 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2002-08-31 04:25:44 +0000 |
commit | cc37b25dbb5feb0c2228e663ff607c9cfe80b941 (patch) | |
tree | 6496da2e417fd05735f3de0655a5fb6b373de639 /sys/ddb | |
parent | 385431ebc407d822797fd1d54db2210bda008c77 (diff) | |
download | FreeBSD-src-cc37b25dbb5feb0c2228e663ff607c9cfe80b941.zip FreeBSD-src-cc37b25dbb5feb0c2228e663ff607c9cfe80b941.tar.gz |
db_ps.c:
Don't attempt to follow null pointers for zombie processes in db_ps().
Style fix: use explicit an comparison with NULL for all null pointer
checks in db_ps() instead of for half of them.
db_interface.c:
Fixed ddb's handling of traps from with ddb on i386's only.
This was mostly fixed in rev.1.27 (by longjmp()'ing back to the top
level) but was completly broken in rev.1.48 (by not unwinding the new
state (mainly db_active) either before or after the longjmp(). This
mostly never worked for other arches, since rev.1.27 has not been ported
and lower level longjmp()'s only handle traps for memory accesses. All
cases should be handled at a lower level to provided better control and
simplify unwinding of state.
Implementation details: don't pretend to maintain db_active in a nested
way -- ddb cannot be reentered in a nested way. Use db_active instead
of the db_global_jmpbuf_valid flag and longjmp()'s return value for things
related to reentering ddb. [re]entering is still not atomic enough.
Diffstat (limited to 'sys/ddb')
-rw-r--r-- | sys/ddb/db_ps.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c index 05c0778..7025ee3 100644 --- a/sys/ddb/db_ps.c +++ b/sys/ddb/db_ps.c @@ -120,14 +120,15 @@ db_ps(dummy1, dummy2, dummy3, dummy4) } db_printf("%5d %8p %8p %4d %5d %5d %07x %-4s", p->p_pid, (volatile void *)p, (void *)p->p_uarea, - p->p_ucred ? p->p_ucred->cr_ruid : 0, pp->p_pid, - p->p_pgrp ? p->p_pgrp->pg_id : 0, p->p_flag, state); + p->p_ucred != NULL ? p->p_ucred->cr_ruid : 0, pp->p_pid, + p->p_pgrp != NULL ? p->p_pgrp->pg_id : 0, p->p_flag, + state); if (p->p_flag & P_KSES) { db_printf("(threaded) %s\n", p->p_comm); FOREACH_THREAD_IN_PROC(p, td) { db_printf( ". . . . . . . " ". thread %p . . . ", td); - if (td->td_wchan) { + if (td->td_wchan != NULL) { db_printf("SLP %6s %8p\n", td->td_wmesg, (void *)td->td_wchan); } else if (td->td_state == TDS_MTX) { @@ -139,10 +140,10 @@ db_ps(dummy1, dummy2, dummy3, dummy4) } } else { td = FIRST_THREAD_IN_PROC(p); - if (td->td_wchan) { + if (td != NULL && td->td_wchan != NULL) { db_printf(" %-6s %8p", td->td_wmesg, (void *)td->td_wchan); - } else if (td->td_state == TDS_MTX) { + } else if (td != NULL && td->td_state == TDS_MTX) { db_printf(" %6s %8p", td->td_mtxname, (void *)td->td_blocked); } else { |