summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2018-05-03 07:47:03 +0000
committeravg <avg@FreeBSD.org>2018-05-03 07:47:03 +0000
commit60ce6f943f0956c28f5f2becc495ea9421a4fe02 (patch)
tree70fbdf8dfadd94044a4c48b9cf31a48cbfec0dd2 /sys/powerpc
parent9e24ade5fe773c0680a14d29f4599709c5911ff0 (diff)
downloadFreeBSD-src-60ce6f943f0956c28f5f2becc495ea9421a4fe02.zip
FreeBSD-src-60ce6f943f0956c28f5f2becc495ea9421a4fe02.tar.gz
MFC r332752: set kdb_why to "trap" when calling kdb_trap from trap_fatal
This will allow to hook a ddb script to "kdb.enter.trap" event. Previously there was no specific name for this event, so it could only be handled by either "kdb.enter.unknown" or "kdb.enter.default" hooks. Both are very unspecific. Having a specific event is useful because the fatal trap condition is very similar to panic but it has an additional property that the current stack frame is the frame where the trap occurred. So, both a register dump and a stack bottom dump have additional information that can help analyze the problem. I have added the event only on architectures that have trap_fatal() function defined. I haven't looked at other architectures. Their maintainers can add support for the event later. Sample script: kdb.enter.trap=bt; show reg; x/aS $rsp,20; x/agx $rsp,20 Sponsored by: Panzura
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/powerpc/trap.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/powerpc/powerpc/trap.c b/sys/powerpc/powerpc/trap.c
index e201352..d1dc325 100644
--- a/sys/powerpc/powerpc/trap.c
+++ b/sys/powerpc/powerpc/trap.c
@@ -389,11 +389,19 @@ trap(struct trapframe *frame)
static void
trap_fatal(struct trapframe *frame)
{
+#ifdef KDB
+ bool handled;
+#endif
printtrap(frame->exc, frame, 1, (frame->srr1 & PSL_PR));
#ifdef KDB
- if (debugger_on_panic && kdb_trap(frame->exc, 0, frame))
- return;
+ if (debugger_on_panic) {
+ kdb_why = KDB_WHY_TRAP;
+ handled = kdb_trap(frame->exc, 0, frame);
+ kdb_why = KDB_WHY_UNSET;
+ if (handled)
+ return;
+ }
#endif
panic("%s trap", trapname(frame->exc));
}
OpenPOWER on IntegriCloud