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;
 }
 
 /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to