Page MenuHomeFreeBSD

D60445.1795976752.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D60445.1795976752.diff

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
@@ -547,11 +547,23 @@
.\"
.Pp
.It Xo
-.Ic Ic reboot Ns Op Li / Ns Cm s
+.Ic Ic reboot
.Op Ar seconds
.Xc
+Reboot the system, running registered shutdown handlers.
+If the optional argument
+.Ar seconds
+is given, the debugger will wait for this long, at most a week,
+before rebooting.
+.Pp
+This can occasionally fail or recurse in a panic context; see
+.Xr kern_reboot 9
+for more info, and use the
+.Ic reset
+command instead.
+.Pp
.It Xo
-.Ic Ic reset Ns Op Li / Ns Cm s
+.Ic Ic reset
.Op Ar seconds
.Xc
Hard reset the system.
@@ -559,10 +571,6 @@
.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
@@ -72,6 +72,7 @@
static db_cmdfcn_t db_gdb;
static db_cmdfcn_t db_halt;
static db_cmdfcn_t db_kill;
+static db_cmdfcn_t db_reboot;
static db_cmdfcn_t db_reset;
static db_cmdfcn_t db_stack_trace;
static db_cmdfcn_t db_stack_trace_active;
@@ -155,7 +156,7 @@
DB_CMD("ps", db_ps, DB_CMD_MEMSAFE),
DB_CMD("gdb", db_gdb, 0),
DB_CMD("halt", db_halt, DB_CMD_MEMSAFE),
- DB_CMD("reboot", db_reset, DB_CMD_MEMSAFE),
+ DB_CMD("reboot", db_reboot, DB_CMD_MEMSAFE),
DB_CMD("reset", db_reset, DB_CMD_MEMSAFE),
DB_CMD("kill", db_kill, CS_OWN|DB_CMD_MEMSAFE),
DB_CMD("watchdog", db_watchdog, CS_OWN|DB_CMD_MEMSAFE),
@@ -747,8 +748,7 @@
#endif
static void
-db_reset(db_expr_t addr, bool have_addr, db_expr_t count __unused,
- char *modif)
+_db_reset(db_expr_t addr, bool have_addr, bool shutdown_path)
{
int delay, loop;
@@ -780,12 +780,26 @@
* and rely on some other non-standard mechanism to perform the reset.
* For example, the BCM2835 watchdog driver or gpio-poweroff driver.
*/
- if (modif[0] != 's') {
+ if (shutdown_path) {
kern_reboot(RB_NOSYNC);
- /* NOTREACHED */
+ } else {
+ cpu_reset();
}
+ /* NOTREACHED */
+}
+
+static void
+db_reset(db_expr_t addr, bool have_addr, db_expr_t count __unused,
+ char *modif __unused)
+{
+ _db_reset(addr, have_addr, false);
+}
- cpu_reset();
+static void
+db_reboot(db_expr_t addr, bool have_addr, db_expr_t count __unused,
+ char *modif __unused)
+{
+ _db_reset(addr, have_addr, true);
}
static void

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 29, 6:25 PM (14 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42094311
Default Alt Text
D60445.1795976752.diff (2 KB)

Event Timeline