KDB_TRACE and no backend

Andriy Gapon avg at freebsd.org
Sat Sep 18 20:30:06 UTC 2010


on 18/09/2010 22:00 Andriy Gapon said the following:
> Oh, wow, and I totally overlooked stack_print().
> Should have read stack(9) from the start.

New patch.  Hope this is better.
I don't like that the printf is duplicated, but couldn't figure out a way to
combine pre-processor and C conditions.

--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/pcpu.h>
 #include <sys/proc.h>
 #include <sys/smp.h>
+#include <sys/stack.h>
 #include <sys/sysctl.h>

 #include <machine/kdb.h>
@@ -300,6 +301,15 @@ kdb_backtrace(void)
 		printf("KDB: stack backtrace:\n");
 		kdb_dbbe->dbbe_trace();
 	}
+#ifdef STACK
+	else {
+		struct stack st;
+
+		printf("KDB: stack backtrace:\n");
+		stack_save(&st);
+		stack_print(&st);
+	}
+#endif
 }

 /*


-- 
Andriy Gapon


More information about the freebsd-hackers mailing list