kdb: set kdb_why when entered via reboot and panic

Reviewed by:	jhb
Sponsored by:   NetApp, Inc.
Sponsored by:   Klara, Inc.
X-NetApp-PR:    #74
Differential Revision:	https://reviews.freebsd.org/D34551
This commit is contained in:
Tom Jones 2022-04-12 10:30:22 +01:00
parent 742e7210d0
commit 1ea833a572
2 changed files with 4 additions and 1 deletions

View File

@ -292,6 +292,7 @@ void
kdb_panic(const char *msg) kdb_panic(const char *msg)
{ {
kdb_why = KDB_WHY_PANIC;
printf("KDB: panic\n"); printf("KDB: panic\n");
panic("%s", msg); panic("%s", msg);
} }
@ -300,6 +301,7 @@ void
kdb_reboot(void) kdb_reboot(void)
{ {
kdb_why = KDB_WHY_REBOOT;
printf("KDB: reboot requested\n"); printf("KDB: reboot requested\n");
shutdown_nice(0); shutdown_nice(0);
} }
@ -498,9 +500,9 @@ kdb_enter(const char *why, const char *msg)
{ {
if (kdb_dbbe != NULL && kdb_active == 0) { if (kdb_dbbe != NULL && kdb_active == 0) {
kdb_why = why;
if (msg != NULL) if (msg != NULL)
printf("KDB: enter: %s\n", msg); printf("KDB: enter: %s\n", msg);
kdb_why = why;
breakpoint(); breakpoint();
kdb_why = KDB_WHY_UNSET; kdb_why = KDB_WHY_UNSET;
} }

View File

@ -121,6 +121,7 @@ extern const char * volatile kdb_why;
#define KDB_WHY_POWERPC "powerpc" /* Unhandled powerpc intr. */ #define KDB_WHY_POWERPC "powerpc" /* Unhandled powerpc intr. */
#define KDB_WHY_UNIONFS "unionfs" /* Unionfs bug. */ #define KDB_WHY_UNIONFS "unionfs" /* Unionfs bug. */
#define KDB_WHY_DTRACE "dtrace" /* DTrace action entered debugger. */ #define KDB_WHY_DTRACE "dtrace" /* DTrace action entered debugger. */
#define KDB_WHY_REBOOT "reboot" /* reboot was requested. */
/* Return values for kdb_alt_break */ /* Return values for kdb_alt_break */
#define KDB_REQ_DEBUGGER 1 /* User requested Debugger */ #define KDB_REQ_DEBUGGER 1 /* User requested Debugger */