svn commit: r366798 - head/sys/kern
Bjoern A. Zeeb
bz at FreeBSD.org
Sat Oct 17 22:47:09 UTC 2020
Author: bz
Date: Sat Oct 17 22:47:08 2020
New Revision: 366798
URL: https://svnweb.freebsd.org/changeset/base/366798
Log:
ddb: add show sysinit command
Add a show sysinit command to ddb (similar to show vnet_sysinit) which
proved to be helpful to debug some ordering issues on early-mid kernel
start panics.
Modified:
head/sys/kern/init_main.c
Modified: head/sys/kern/init_main.c
==============================================================================
--- head/sys/kern/init_main.c Sat Oct 17 21:30:46 2020 (r366797)
+++ head/sys/kern/init_main.c Sat Oct 17 22:47:08 2020 (r366798)
@@ -47,6 +47,7 @@
__FBSDID("$FreeBSD$");
#include "opt_ddb.h"
+#include "opt_kdb.h"
#include "opt_init_path.h"
#include "opt_verbose_sysinit.h"
@@ -838,3 +839,51 @@ kick_init(const void *udata __unused)
sched_add(td, SRQ_BORING);
}
SYSINIT(kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE, kick_init, NULL);
+
+/*
+ * DDB(4).
+ */
+#ifdef DDB
+static void
+db_show_print_syinit(struct sysinit *sip, bool ddb)
+{
+ const char *sname, *funcname;
+ c_db_sym_t sym;
+ db_expr_t offset;
+
+#define xprint(...) \
+ if (ddb) \
+ db_printf(__VA_ARGS__); \
+ else \
+ printf(__VA_ARGS__)
+
+ if (sip == NULL) {
+ xprint("%s: no sysinit * given\n", __func__);
+ return;
+ }
+
+ sym = db_search_symbol((vm_offset_t)sip, DB_STGY_ANY, &offset);
+ db_symbol_values(sym, &sname, NULL);
+ sym = db_search_symbol((vm_offset_t)sip->func, DB_STGY_PROC, &offset);
+ db_symbol_values(sym, &funcname, NULL);
+ xprint("%s(%p)\n", (sname != NULL) ? sname : "", sip);
+ xprint(" %#08x %#08x\n", sip->subsystem, sip->order);
+ xprint(" %p(%s)(%p)\n",
+ sip->func, (funcname != NULL) ? funcname : "", sip->udata);
+#undef xprint
+}
+
+DB_SHOW_COMMAND(sysinit, db_show_sysinit)
+{
+ struct sysinit **sipp;
+
+ db_printf("SYSINIT vs Name(Ptr)\n");
+ db_printf(" Subsystem Order\n");
+ db_printf(" Function(Name)(Arg)\n");
+ for (sipp = sysinit; sipp < sysinit_end; sipp++) {
+ db_show_print_syinit(*sipp, true);
+ if (db_pager_quit)
+ break;
+ }
+}
+#endif /* DDB */
More information about the svn-src-all
mailing list