From 0f4d3c921d770fac8b24aeff19fe7df1aea2e314 Mon Sep 17 00:00:00 2001 From: Gavin Atkinson Date: Wed, 13 Apr 2011 19:10:56 +0000 Subject: [PATCH] Add a new DDB command, "show rmans", which will show the address and brief details of each rman header, but not the contents of all rman structures in the system. This is especially useful on platforms where some rmans have many thousands of entries in rmans, making scrolling through the output of "show all rman" impractical. Individual rmans can then be viewed including their contents with "show rman 0xaddr" as usual. Reviewed by: jhb --- sys/kern/subr_rman.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index 0e53499e0de..cfa4983004a 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -926,6 +926,16 @@ SYSCTL_NODE(_hw_bus, OID_AUTO, rman, CTLFLAG_RD, sysctl_rman, "kernel resource manager"); #ifdef DDB +static void +dump_rman_header(struct rman *rm) +{ + + if (db_pager_quit) + return; + db_printf("rman %p: %s (0x%lx-0x%lx full range)\n", + rm, rm->rm_descr, rm->rm_start, rm->rm_end); +} + static void dump_rman(struct rman *rm) { @@ -934,8 +944,6 @@ dump_rman(struct rman *rm) if (db_pager_quit) return; - db_printf("rman: %s\n", rm->rm_descr); - db_printf(" 0x%lx-0x%lx (full range)\n", rm->rm_start, rm->rm_end); TAILQ_FOREACH(r, &rm->rm_list, r_link) { if (r->r_dev != NULL) { devname = device_get_nameunit(r->r_dev); @@ -956,16 +964,29 @@ dump_rman(struct rman *rm) DB_SHOW_COMMAND(rman, db_show_rman) { - if (have_addr) + if (have_addr) { + dump_rman_header((struct rman *)addr); dump_rman((struct rman *)addr); + } +} + +DB_SHOW_COMMAND(rmans, db_show_rmans) +{ + struct rman *rm; + + TAILQ_FOREACH(rm, &rman_head, rm_link) { + dump_rman_header(rm); + } } DB_SHOW_ALL_COMMAND(rman, db_show_all_rman) { struct rman *rm; - TAILQ_FOREACH(rm, &rman_head, rm_link) + TAILQ_FOREACH(rm, &rman_head, rm_link) { + dump_rman_header(rm); dump_rman(rm); + } } DB_SHOW_ALIAS(allrman, db_show_all_rman); #endif