summaryrefslogtreecommitdiffstats
path: root/sys/ddb
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2005-10-02 11:41:12 +0000
committerrwatson <rwatson@FreeBSD.org>2005-10-02 11:41:12 +0000
commitf3a3ddf22dd675e45b6ec4041f0989e0b5e5cde3 (patch)
tree531ea002aba6d47eab2e7b14f2a9654c9b434e27 /sys/ddb
parent0433eb44c6bb2617a9b1af50f6ad29444c87320c (diff)
downloadFreeBSD-src-f3a3ddf22dd675e45b6ec4041f0989e0b5e5cde3.zip
FreeBSD-src-f3a3ddf22dd675e45b6ec4041f0989e0b5e5cde3.tar.gz
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
Diffstat (limited to 'sys/ddb')
-rw-r--r--sys/ddb/db_command.c18
1 files changed, 18 insertions, 0 deletions
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);
+ }
+ }
+}
OpenPOWER on IntegriCloud