Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Apr 2011 19:10:56 +0000 (UTC)
From:      Gavin Atkinson <gavin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220606 - head/sys/kern
Message-ID:  <201104131910.p3DJAuIk008734@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gavin
Date: Wed Apr 13 19:10:56 2011
New Revision: 220606
URL: http://svn.freebsd.org/changeset/base/220606

Log:
  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

Modified:
  head/sys/kern/subr_rman.c

Modified: head/sys/kern/subr_rman.c
==============================================================================
--- head/sys/kern/subr_rman.c	Wed Apr 13 18:19:41 2011	(r220605)
+++ head/sys/kern/subr_rman.c	Wed Apr 13 19:10:56 2011	(r220606)
@@ -927,6 +927,16 @@ SYSCTL_NODE(_hw_bus, OID_AUTO, rman, CTL
 
 #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)
 {
 	struct resource_i *r;
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104131910.p3DJAuIk008734>