path: root/sys/sys/kdb.h
diff options
authorAndriy Gapon <avg@FreeBSD.org>2018-04-19 05:06:56 +0000
committerAndriy Gapon <avg@FreeBSD.org>2018-04-19 05:06:56 +0000
commitf3f6ecb45067c94a3d92a0ca49f561c390d39d7e (patch)
tree3b5a451df66f02f4e39471666eeac83e1d5552b4 /sys/sys/kdb.h
parent807dbf2b9440a2519190663e711ec8cd95221c3a (diff)
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 Reviewed by: kib, jhb, markj MFC after: 11 days Sponsored by: Panzura Differential Revision: https://reviews.freebsd.org/D15093
Notes: svn path=/head/; revision=332752
Diffstat (limited to 'sys/sys/kdb.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/sys/kdb.h b/sys/sys/kdb.h
index d1f352fcb837..8834b0fa8172 100644
--- a/sys/sys/kdb.h
+++ b/sys/sys/kdb.h
@@ -101,6 +101,7 @@ extern const char * volatile kdb_why;
#define KDB_WHY_UNSET NULL /* No reason set. */
#define KDB_WHY_PANIC "panic" /* panic() was called. */
#define KDB_WHY_KASSERT "kassert" /* kassert failed. */
+#define KDB_WHY_TRAP "trap" /* Fatal trap. */
#define KDB_WHY_SYSCTL "sysctl" /* Sysctl entered debugger. */
#define KDB_WHY_BOOTFLAGS "bootflags" /* Boot flags were set. */
#define KDB_WHY_WITNESS "witness" /* Witness entered debugger. */