diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4 --- a/share/man/man4/ddb.4 +++ b/share/man/man4/ddb.4 @@ -524,13 +524,23 @@ argument limits the search. .\" .Pp -.It Ic reboot Op Ar seconds -.It Ic reset Op Ar seconds +.It Xo +.Ic Ic reboot Ns Op Li / Ns Cm s +.Op Ar seconds +.Xc +.It Xo +.Ic Ic reset Ns Op Li / Ns Cm s +.Op Ar seconds +.Xc Hard reset the system. If the optional argument .Ar seconds is given, the debugger will wait for this long, at most a week, before rebooting. +When the +.Cm s +modifier is given, the command will skip running any registered shutdown +handlers and attempt the most basic reset. .Pp .It Ic thread Ar addr | tid Switch the debugger to the thread with ID diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -745,7 +745,7 @@ static void db_reset(db_expr_t addr, bool have_addr, db_expr_t count __unused, - char *modif __unused) + char *modif) { int delay, loop; @@ -770,6 +770,13 @@ } } + /* + * Conditionally try the standard reboot path, so registered + * shutdown/reset handlers have a chance. + */ + if (modif[0] != 's') + kern_reboot(RB_NOSYNC); + cpu_reset(); } diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -270,8 +270,6 @@ SHUTDOWN_PRI_LAST + 100); EVENTHANDLER_REGISTER(shutdown_final, shutdown_panic, NULL, SHUTDOWN_PRI_LAST + 100); - EVENTHANDLER_REGISTER(shutdown_final, shutdown_reset, NULL, - SHUTDOWN_PRI_LAST + 200); } SYSINIT(shutdown_conf, SI_SUB_INTRINSIC, SI_ORDER_ANY, shutdown_conf, NULL); @@ -548,6 +546,12 @@ EVENTHANDLER_INVOKE(shutdown_final, howto); + /* + * Call this directly so that reset is attempted even if shutdown + * handlers are not yet registered. + */ + shutdown_reset(NULL, howto); + for(;;) ; /* safety against shutdown_reset not working */ /* NOTREACHED */ }