aboutsummaryrefslogtreecommitdiff
path: root/sys/ddb
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2021-01-01 00:01:12 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2021-01-01 00:01:12 +0000
commit825d234144c5006e81c752bda7b9bcc2f822707e (patch)
tree741215cb06c6cd0bc8f599490d7c6d1dcaab0d49 /sys/ddb
parent9acce1c99299b5b59998e2d0c461bcf01d959374 (diff)
downloadsrc-825d234144c5006e81c752bda7b9bcc2f822707e.tar.gz
src-825d234144c5006e81c752bda7b9bcc2f822707e.zip
Don't check P_INMEM in kdb_thr_*().
Not all debugger operations that enumerate threads require thread stacks to be resident in memory to be useful. Instead, push P_INMEM checks (if needed) into callers. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27827
Diffstat (limited to 'sys/ddb')
-rw-r--r--sys/ddb/db_command.c5
-rw-r--r--sys/ddb/db_thread.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 1a836be335bf..1fa1cd1b7bb9 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -838,7 +838,10 @@ db_stack_trace(db_expr_t tid, bool hastid, db_expr_t count, char *modif)
else
pid = -1;
db_printf("Tracing pid %d tid %ld td %p\n", pid, (long)td->td_tid, td);
- db_trace_thread(td, count);
+ if (td->td_proc != NULL && (td->td_proc->p_flag & P_INMEM) == 0)
+ db_printf("--- swapped out\n");
+ else
+ db_trace_thread(td, count);
}
static void
diff --git a/sys/ddb/db_thread.c b/sys/ddb/db_thread.c
index 780301a22106..e7619dc368fe 100644
--- a/sys/ddb/db_thread.c
+++ b/sys/ddb/db_thread.c
@@ -90,8 +90,11 @@ db_show_threads(db_expr_t addr, bool hasaddr, db_expr_t cnt, char *mod)
(void *)thr->td_kstack);
prev_jb = kdb_jmpbuf(jb);
if (setjmp(jb) == 0) {
- if (db_trace_thread(thr, 1) != 0)
- db_printf("***\n");
+ if (thr->td_proc->p_flag & P_INMEM) {
+ if (db_trace_thread(thr, 1) != 0)
+ db_printf("***\n");
+ } else
+ db_printf("*** swapped out\n");
}
kdb_jmpbuf(prev_jb);
thr = kdb_thr_next(thr);