mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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
This commit is contained in:
parent
9acce1c992
commit
825d234144
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -590,11 +590,9 @@ kdb_thr_first(void)
|
|||
|
||||
for (i = 0; i <= pidhash; i++) {
|
||||
LIST_FOREACH(p, &pidhashtbl[i], p_hash) {
|
||||
if (p->p_flag & P_INMEM) {
|
||||
thr = FIRST_THREAD_IN_PROC(p);
|
||||
if (thr != NULL)
|
||||
return (thr);
|
||||
}
|
||||
thr = FIRST_THREAD_IN_PROC(p);
|
||||
if (thr != NULL)
|
||||
return (thr);
|
||||
}
|
||||
}
|
||||
return (NULL);
|
||||
|
@ -606,7 +604,7 @@ kdb_thr_from_pid(pid_t pid)
|
|||
struct proc *p;
|
||||
|
||||
LIST_FOREACH(p, PIDHASH(pid), p_hash) {
|
||||
if (p->p_flag & P_INMEM && p->p_pid == pid)
|
||||
if (p->p_pid == pid)
|
||||
return (FIRST_THREAD_IN_PROC(p));
|
||||
}
|
||||
return (NULL);
|
||||
|
@ -641,8 +639,9 @@ kdb_thr_next(struct thread *thr)
|
|||
return (NULL);
|
||||
p = LIST_FIRST(&pidhashtbl[hash]);
|
||||
}
|
||||
if (p->p_flag & P_INMEM)
|
||||
return (FIRST_THREAD_IN_PROC(p));
|
||||
thr = FIRST_THREAD_IN_PROC(p);
|
||||
if (thr != NULL)
|
||||
return (thr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue