From f3a3ddf22dd675e45b6ec4041f0989e0b5e5cde3 Mon Sep 17 00:00:00 2001 From: rwatson Date: Sun, 2 Oct 2005 11:41:12 +0000 Subject: Add a DDB "traceall" function, which stack traces all known process threads. This is quite useful if generating a debug log for post-mortem by another developer, in which case the person at the console may not know which threads are of interest. The output of this can be quite long. Discussed with: kris MFC after: 3 days --- sys/ddb/db_command.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index d20c4a3..91c8fcc 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -71,6 +71,7 @@ static db_cmdfcn_t db_gdb; static db_cmdfcn_t db_kill; static db_cmdfcn_t db_reset; static db_cmdfcn_t db_stack_trace; +static db_cmdfcn_t db_stack_trace_all; static db_cmdfcn_t db_watchdog; /* @@ -114,6 +115,7 @@ static struct command db_command_table[] = { { "next", db_trace_until_matching_cmd,0, 0 }, { "match", db_trace_until_matching_cmd,0, 0 }, { "trace", db_stack_trace, CS_OWN, 0 }, + { "traceall", db_stack_trace_all, 0, 0 }, { "where", db_stack_trace, CS_OWN, 0 }, { "call", db_fncall, CS_OWN, 0 }, { "show", 0, 0, db_show_cmds }, @@ -675,3 +677,19 @@ db_stack_trace(db_expr_t tid, boolean_t hastid, db_expr_t count, char *modif) db_printf("Tracing pid %d tid %ld td %p\n", pid, (long)td->td_tid, td); db_trace_thread(td, count); } + +static void +db_stack_trace_all(db_expr_t dummy, boolean_t dummy2, db_expr_t dummy3, + char *dummy4) +{ + struct proc *p; + struct thread *td; + + for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) { + FOREACH_THREAD_IN_PROC(p, td) { + db_printf("\nTracing command %s pid %d tid %ld td %p\n", + p->p_comm, p->p_pid, (long)td->td_tid, td); + db_trace_thread(td, -1); + } + } +} -- cgit v1.1