enable dynamic addition of "show all" commands

MFC after:	3 weeks
This commit is contained in:
Sam Leffler 2008-03-25 20:36:32 +00:00
parent 9c8408a472
commit 9e340a6190
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177615
3 changed files with 15 additions and 2 deletions

View File

@ -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[] = {

View File

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

View File

@ -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) = { \