diff options
author | Sam Leffler <sam@FreeBSD.org> | 2008-03-25 20:36:32 +0000 |
---|---|---|
committer | Sam Leffler <sam@FreeBSD.org> | 2008-03-25 20:36:32 +0000 |
commit | 9e340a61900d6ca55e42f2efd41362c666f28f2f (patch) | |
tree | c770cb5d4eaa07771e76b1810d58e0e5ee11991d | |
parent | 9c8408a472d744314f4a305385406edc71e23643 (diff) | |
download | src-9e340a61900d6ca55e42f2efd41362c666f28f2f.tar.gz src-9e340a61900d6ca55e42f2efd41362c666f28f2f.zip |
enable dynamic addition of "show all" commands
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=177615
-rw-r--r-- | sys/ddb/db_command.c | 6 | ||||
-rw-r--r-- | sys/ddb/db_ps.c | 9 | ||||
-rw-r--r-- | sys/ddb/ddb.h | 2 |
3 files changed, 15 insertions, 2 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index db6dc24774c5..0395e75df44e 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 5d5e068c57f7..bf14ecf647c1 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 d5599785090a..57c5fd15985c 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) = { \ |