Module Name:    src
Committed By:   thorpej
Date:           Fri Sep 18 00:09:29 UTC 2020

Modified Files:
        src/sys/arch/alpha/alpha: db_trace.c

Log Message:
- Add exception_return() to the list of trap vector symbols, which will
  enable us to trace back through an exception if the fault happens
  during the exception return.
- Identify and report the kernel thread backstop when back tracing
  kernel threads.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/alpha/db_trace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/alpha/db_trace.c
diff -u src/sys/arch/alpha/alpha/db_trace.c:1.28 src/sys/arch/alpha/alpha/db_trace.c:1.29
--- src/sys/arch/alpha/alpha/db_trace.c:1.28	Mon Feb  6 02:14:10 2012
+++ src/sys/arch/alpha/alpha/db_trace.c	Fri Sep 18 00:09:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.28 2012/02/06 02:14:10 matt Exp $ */
+/* $NetBSD: db_trace.c,v 1.29 2020/09/18 00:09:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.28 2012/02/06 02:14:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.29 2020/09/18 00:09:29 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -85,6 +85,12 @@ static struct special_symbol {
 	{ (vaddr_t)&XentSys,		"syscall" },
 	{ (vaddr_t)&XentUna,		"unaligned access fault" },
 	{ (vaddr_t)&XentRestart,	"console restart" },
+
+	/*
+	 * We'll not know what trap we took, but we'll find the
+	 * trap frame, at least...
+	 */
+	{ (vaddr_t)&exception_return,	"(exception return)" },
 	{ 0 }
 };
 
@@ -256,6 +262,16 @@ db_stack_trace_print(db_expr_t addr, boo
 		}
 
 		/*
+		 * If the previous RA pointed at the kernel thread
+		 * backstop, then we are at the root of the call
+		 * graph.
+		 */
+		if (symval == (vaddr_t)&alpha_kthread_backstop) {
+			(*pr)("--- kernel thread backstop ---\n");
+			break;
+		}
+
+		/*
 		 * XXX Printing out arguments is Hard.  We'd have to
 		 * keep lots of state as we traverse the frame, figuring
 		 * out where the arguments to the function are stored

Reply via email to