diff options
author | John Baldwin <jhb@FreeBSD.org> | 2021-01-01 00:01:35 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2021-01-01 00:01:35 +0000 |
commit | 3e06c7da020fadb8ffbfc26d634ccb321e7e22f7 (patch) | |
tree | 861529a591ea6a3956096c6253909346a87bb4cd /sys/ddb/db_ps.c | |
parent | ae450907c6394332063566b0009f7aa0c296133e (diff) | |
download | src-3e06c7da020fadb8ffbfc26d634ccb321e7e22f7.tar.gz src-3e06c7da020fadb8ffbfc26d634ccb321e7e22f7.zip |
Use kdb_thr_* to iterate over threads consistently in DDB.
The "findstack", "show all trace", and "show active trace" commands
were iterating over allproc to enumerate threads. This missed threads
executing in exit1() after being removed from allproc.
Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27829
Diffstat (limited to 'sys/ddb/db_ps.c')
-rw-r--r-- | sys/ddb/db_ps.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c index da655d11da02..2e5e6332d6e8 100644 --- a/sys/ddb/db_ps.c +++ b/sys/ddb/db_ps.c @@ -512,7 +512,6 @@ void db_findstack_cmd(db_expr_t addr, bool have_addr, db_expr_t dummy3 __unused, char *dummy4 __unused) { - struct proc *p; struct thread *td; vm_offset_t saddr; @@ -523,12 +522,10 @@ db_findstack_cmd(db_expr_t addr, bool have_addr, db_expr_t dummy3 __unused, return; } - FOREACH_PROC_IN_SYSTEM(p) { - FOREACH_THREAD_IN_PROC(p, td) { - if (kstack_contains(td, saddr, 1)) { - db_printf("Thread %p\n", td); - return; - } + for (td = kdb_thr_first(); td != NULL; td = kdb_thr_next(td)) { + if (kstack_contains(td, saddr, 1)) { + db_printf("Thread %p\n", td); + return; } } } |