summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2008-03-25 20:36:32 +0000
committersam <sam@FreeBSD.org>2008-03-25 20:36:32 +0000
commit8e10753c85ea5f78b7f17da0680e9673d12a3f39 (patch)
treec770cb5d4eaa07771e76b1810d58e0e5ee11991d
parent172c1f8c45c281948c9562ee2b7ce282df01fde0 (diff)
downloadFreeBSD-src-8e10753c85ea5f78b7f17da0680e9673d12a3f39.zip
FreeBSD-src-8e10753c85ea5f78b7f17da0680e9673d12a3f39.tar.gz
enable dynamic addition of "show all" commands
MFC after: 3 weeks
-rw-r--r--sys/ddb/db_command.c6
-rw-r--r--sys/ddb/db_ps.c9
-rw-r--r--sys/ddb/ddb.h2
3 files changed, 15 insertions, 2 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index db6dc24..0395e75 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -65,6 +65,7 @@ db_addr_t db_next;
SET_DECLARE(db_cmd_set, struct command);
SET_DECLARE(db_show_cmd_set, struct command);
+SET_DECLARE(db_show_all_cmd_set, struct command);
static db_cmdfcn_t db_fncall;
static db_cmdfcn_t db_gdb;
@@ -80,12 +81,13 @@ static db_cmdfcn_t db_watchdog;
*/
static struct command db_show_all_cmds[] = {
- { "procs", db_ps, 0, 0 },
{ (char *)0 }
};
static struct command_table db_show_all_table = {
- db_show_all_cmds
+ db_show_all_cmds,
+ SET_BEGIN(db_show_all_cmd_set),
+ SET_LIMIT(db_show_all_cmd_set)
};
static struct command db_show_cmds[] = {
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c
index 5d5e068..bf14ecf 100644
--- a/sys/ddb/db_ps.c
+++ b/sys/ddb/db_ps.c
@@ -46,6 +46,15 @@ __FBSDID("$FreeBSD$");
static void dumpthread(volatile struct proc *p, volatile struct thread *td,
int all);
+/*
+ * At least one non-optional show-command must be implemented using
+ * DB_SHOW_ALL_COMMAND() so that db_show_all_cmd_set gets created.
+ * Here is one.
+ */
+DB_SHOW_ALL_COMMAND(procs, db_procs_cmd)
+{
+ db_ps(addr, have_addr, count, modif);
+}
/*
* Layout:
diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h
index d559978..57c5fd1 100644
--- a/sys/ddb/ddb.h
+++ b/sys/ddb/ddb.h
@@ -80,6 +80,8 @@ typedef void db_cmdfcn_t(db_expr_t addr, boolean_t have_addr, db_expr_t count,
DB_FUNC(cmd_name, func_name, db_cmd_set, 0, NULL)
#define DB_SHOW_COMMAND(cmd_name, func_name) \
DB_FUNC(cmd_name, func_name, db_show_cmd_set, 0, NULL)
+#define DB_SHOW_ALL_COMMAND(cmd_name, func_name) \
+ DB_FUNC(cmd_name, func_name, db_show_all_cmd_set, 0, NULL)
#define DB_SET(cmd_name, func_name, set, flag, more) \
static const struct command __CONCAT(cmd_name,_cmd) = { \
OpenPOWER on IntegriCloud