summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Weingartner <weingart@cvs.openbsd.org>1998-02-25 19:53:50 +0000
committerTobias Weingartner <weingart@cvs.openbsd.org>1998-02-25 19:53:50 +0000
commit6215edb23e105cb198c45eff9bb948627c21acb2 (patch)
tree941f8a01866951b96653ebf2d8994c185066fd1a
parentbfe01757d6663db05af58e0717be4b237644735c (diff)
Add command to print out extents. This helps in debugging PnP stuff,
and "it's just plain cool".
-rw-r--r--sys/ddb/db_command.c15
-rw-r--r--sys/ddb/db_command.h3
-rw-r--r--sys/kern/subr_extent.c12
3 files changed, 25 insertions, 5 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 4772ee2a02b..2310a7c1298 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.c,v 1.13 1997/09/08 19:46:37 deraadt Exp $ */
+/* $OpenBSD: db_command.c,v 1.14 1998/02/25 19:53:46 weingart Exp $ */
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
/*
@@ -34,6 +34,7 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/reboot.h>
+#include <sys/extent.h>
#include <vm/vm.h>
#include <machine/db_machdep.h> /* type definitions */
@@ -308,6 +309,17 @@ db_object_print_cmd(addr, have_addr, count, modif)
_vm_object_print((vm_object_t) addr, full, db_printf);
}
+/*ARGSUSED*/
+void
+db_extent_print_cmd(addr, have_addr, count, modif)
+ db_expr_t addr;
+ int have_addr;
+ db_expr_t count;
+ char * modif;
+{
+ extent_print_all();
+}
+
/*
* 'show' commands
*/
@@ -325,6 +337,7 @@ struct db_command db_show_cmds[] = {
{ "watches", db_listwatch_cmd, 0, NULL },
{ "map", db_map_print_cmd, 0, NULL },
{ "object", db_object_print_cmd, 0, NULL },
+ { "extents", db_extent_print_cmd, 0, NULL },
{ NULL, NULL, 0, NULL, }
};
diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h
index 6139a06463f..e9b8831706f 100644
--- a/sys/ddb/db_command.h
+++ b/sys/ddb/db_command.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.h,v 1.6 1997/09/08 19:46:38 deraadt Exp $ */
+/* $OpenBSD: db_command.h,v 1.7 1998/02/25 19:53:48 weingart Exp $ */
/* $NetBSD: db_command.h,v 1.8 1996/02/05 01:56:55 christos Exp $ */
/*
@@ -40,6 +40,7 @@ void db_cmd_list __P((struct db_command *));
void db_command __P((struct db_command **, struct db_command *));
void db_map_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_object_print_cmd __P((db_expr_t, int, db_expr_t, char *));
+void db_extent_print_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_machine_commands_install __P((struct db_command *));
void db_help_cmd __P((db_expr_t, int, db_expr_t, char *));
void db_command_loop __P((void));
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c
index 1bbb4cdbd6a..2e0a72b9282 100644
--- a/sys/kern/subr_extent.c
+++ b/sys/kern/subr_extent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_extent.c,v 1.3 1997/07/12 22:50:06 weingart Exp $ */
+/* $OpenBSD: subr_extent.c,v 1.4 1998/02/25 19:53:49 weingart Exp $ */
/* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */
/*-
@@ -49,6 +49,7 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/queue.h>
+#include <ddb/db_output.h>
#else
/*
* user-land definitions, so it can fit into a testing harness.
@@ -64,6 +65,7 @@
#define free(p, t) free(p)
#define tsleep(chan, pri, str, timo) (EWOULDBLOCK)
#define wakeup(chan) ((void)0)
+#define db_printf printf
#endif
static void extent_insert_and_optimize __P((struct extent *, u_long, u_long,
@@ -990,6 +992,10 @@ extent_free_region_descriptor(ex, rp)
free(rp, ex->ex_mtype);
}
+#ifndef DDB
+#define db_printf printf
+#endif
+
void
extent_print(ex)
struct extent *ex;
@@ -999,10 +1005,10 @@ extent_print(ex)
if (ex == NULL)
panic("extent_print: NULL extent");
- printf("extent `%s' (0x%lx - 0x%lx), flags = 0x%x\n", ex->ex_name,
+ db_printf("extent `%s' (0x%lx - 0x%lx), flags = 0x%x\n", ex->ex_name,
ex->ex_start, ex->ex_end, ex->ex_flags);
for (rp = ex->ex_regions.lh_first; rp != NULL;
rp = rp->er_link.le_next)
- printf(" 0x%lx - 0x%lx\n", rp->er_start, rp->er_end);
+ db_printf(" 0x%lx - 0x%lx\n", rp->er_start, rp->er_end);
}