Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jul 2017 17:39:11 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321571 - head/sys/arm64/arm64
Message-ID:  <201707261739.v6QHdBJ3099180@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Jul 26 17:39:10 2017
New Revision: 321571
URL: https://svnweb.freebsd.org/changeset/base/321571

Log:
  Pass the last exception trap frame to kdb_trap. This allows show registers
  in ddb to show the traps registers, and not the registers from within the
  panic call.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/arm64/arm64/trap.c

Modified: head/sys/arm64/arm64/trap.c
==============================================================================
--- head/sys/arm64/arm64/trap.c	Wed Jul 26 17:38:29 2017	(r321570)
+++ head/sys/arm64/arm64/trap.c	Wed Jul 26 17:39:10 2017	(r321571)
@@ -265,6 +265,7 @@ print_registers(struct trapframe *frame)
 void
 do_el1h_sync(struct thread *td, struct trapframe *frame)
 {
+	struct trapframe *oframe;
 	uint32_t exception;
 	uint64_t esr, far;
 
@@ -281,6 +282,18 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
 	    "do_el1_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td,
 	    esr, frame->tf_elr, frame);
 
+	oframe = td->td_frame;
+
+	switch (exception) {
+	case EXCP_BRK:
+	case EXCP_WATCHPT_EL1:
+	case EXCP_SOFTSTP_EL1:
+		break;
+	default:
+		td->td_frame = frame;
+		break;
+	}
+
 	switch(exception) {
 	case EXCP_FP_SIMD:
 	case EXCP_TRAP_FP:
@@ -313,7 +326,8 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
 	case EXCP_WATCHPT_EL1:
 	case EXCP_SOFTSTP_EL1:
 #ifdef KDB
-		kdb_trap(exception, 0, frame);
+		kdb_trap(exception, 0,
+		    (td->td_frame != NULL) ? td->td_frame : frame);
 #else
 		panic("No debugger in kernel.\n");
 #endif
@@ -323,6 +337,8 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
 		panic("Unknown kernel exception %x esr_el1 %lx\n", exception,
 		    esr);
 	}
+
+	td->td_frame = oframe;
 }
 
 /*



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