summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2007-06-04 16:52:39 +0000
committermiod <miod@openbsd.org>2007-06-04 16:52:39 +0000
commit7f8c438f6c92f4cc1d9f87ad2693f13d706da4ad (patch)
treefa8caab7d058b3a3d56b23dbbb4bb0c7283fa7f6
parentBring presto's readdisklabel() usage into line with other uses. i.e. (diff)
downloadwireguard-openbsd-7f8c438f6c92f4cc1d9f87ad2693f13d706da4ad.tar.xz
wireguard-openbsd-7f8c438f6c92f4cc1d9f87ad2693f13d706da4ad.zip
If it's cold at panic time, attempt to show a small backtrace, there are too
many machines where glass console does not work correctly at this stage. By popular demand...
-rw-r--r--sys/ddb/db_trap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/ddb/db_trap.c b/sys/ddb/db_trap.c
index a3c024af6fe..94a7cff8b74 100644
--- a/sys/ddb/db_trap.c
+++ b/sys/ddb/db_trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trap.c,v 1.11 2006/03/13 06:23:20 jsg Exp $ */
+/* $OpenBSD: db_trap.c,v 1.12 2007/06/04 16:52:39 miod Exp $ */
/* $NetBSD: db_trap.c,v 1.9 1996/02/05 01:57:18 christos Exp $ */
/*
@@ -47,6 +47,7 @@
#include <ddb/db_output.h>
#include <ddb/db_sym.h>
#include <ddb/db_extern.h>
+#include <ddb/db_interface.h>
void
db_trap(int type, int code)
@@ -72,6 +73,15 @@ db_trap(int type, int code)
db_dot = PC_REGS(DDB_REGS);
db_print_loc_and_inst(db_dot);
+ /*
+ * Just in case we do not have any usable console driver,
+ * give the user a traceback.
+ */
+ if (cold) {
+ db_stack_trace_print(db_dot, 0, 20 /* arbitrary */, "",
+ db_printf);
+ }
+
if (panicstr != NULL) {
if (db_print_position() != 0)
db_printf("\n");