Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Sep 2010 23:30:02 +0300
From:      Andriy Gapon <avg@freebsd.org>
To:        Attilio Rao <attilio@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: KDB_TRACE and no backend
Message-ID:  <4C95214A.3070600@freebsd.org>
In-Reply-To: <4C950C48.6020600@freebsd.org>
References:  <4C94A138.8050905@icyb.net.ua> <AANLkTingR6k6xdQJ3cZH8EkJeCWnq5vzeEjGHNaDv8AT@mail.gmail.com> <4C9507D1.3010008@icyb.net.ua> <4C950C48.6020600@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C95214A.3070600>