summaryrefslogtreecommitdiff
path: root/sys/ddb/db_output.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-05-18 18:22:47 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-05-18 18:22:47 +0000
commitb53874f6b4b19059defc84c141d0269b1aad1957 (patch)
treea199c5ceb349fc4755c6f4b62a079b060a17fca9 /sys/ddb/db_output.c
parent8f7044cbf127a7ac249e1b339722f078b855d609 (diff)
Implement db_stack_dump - a function that will print a stack
trace with printf (to the console and into the msgbuf).
Diffstat (limited to 'sys/ddb/db_output.c')
-rw-r--r--sys/ddb/db_output.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c
index bc55e0f9723..01e43954719 100644
--- a/sys/ddb/db_output.c
+++ b/sys/ddb/db_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_output.c,v 1.18 2002/05/14 16:12:33 art Exp $ */
+/* $OpenBSD: db_output.c,v 1.19 2002/05/18 18:22:46 art Exp $ */
/* $NetBSD: db_output.c,v 1.13 1996/04/01 17:27:14 christos Exp $ */
/*
@@ -240,3 +240,23 @@ db_format(char *buf, size_t bufsize, long val, int format, int alt, int width)
return (buf);
}
+
+void
+db_stack_dump(void)
+{
+ static int intrace;
+
+ if (intrace) {
+db_panic = 1;
+panic("foo");
+ printf("Faulted in traceback, aborting...\n");
+ return;
+ }
+
+ intrace = 1;
+ printf("Starting stack trace...\n");
+ db_stack_trace_print((db_expr_t)__builtin_frame_address(0), TRUE,
+ 256 /* low limit */, "", printf);
+ printf("End of stack trace.\n");
+ intrace = 0;
+}