ddb: namespacing of struct command
'command' is too generic for something specific to the kernel debugger; change this so it is less likely to collide with local variable names. Also rename struct command_table to struct db_command_table. Reviewed by: markj MFC after: 1 week Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35367
This commit is contained in:
parent
648a47b854
commit
4ef7db5a7e
@ -83,28 +83,28 @@ static db_cmdfcn_t db_watchdog;
|
|||||||
* 'show' commands
|
* 'show' commands
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct command db_show_active_cmds[] = {
|
static struct db_command db_show_active_cmds[] = {
|
||||||
{ "trace", db_stack_trace_active, 0, NULL },
|
{ "trace", db_stack_trace_active, 0, NULL },
|
||||||
};
|
};
|
||||||
struct command_table db_show_active_table =
|
struct db_command_table db_show_active_table =
|
||||||
LIST_HEAD_INITIALIZER(db_show_active_table);
|
LIST_HEAD_INITIALIZER(db_show_active_table);
|
||||||
|
|
||||||
static struct command db_show_all_cmds[] = {
|
static struct db_command db_show_all_cmds[] = {
|
||||||
{ "trace", db_stack_trace_all, 0, NULL },
|
{ "trace", db_stack_trace_all, 0, NULL },
|
||||||
};
|
};
|
||||||
struct command_table db_show_all_table =
|
struct db_command_table db_show_all_table =
|
||||||
LIST_HEAD_INITIALIZER(db_show_all_table);
|
LIST_HEAD_INITIALIZER(db_show_all_table);
|
||||||
|
|
||||||
static struct command db_show_cmds[] = {
|
static struct db_command db_show_cmds[] = {
|
||||||
{ "active", 0, 0, &db_show_active_table },
|
{ "active", 0, 0, &db_show_active_table },
|
||||||
{ "all", 0, 0, &db_show_all_table },
|
{ "all", 0, 0, &db_show_all_table },
|
||||||
{ "registers", db_show_regs, 0, NULL },
|
{ "registers", db_show_regs, 0, NULL },
|
||||||
{ "breaks", db_listbreak_cmd, 0, NULL },
|
{ "breaks", db_listbreak_cmd, 0, NULL },
|
||||||
{ "threads", db_show_threads, 0, NULL },
|
{ "threads", db_show_threads, 0, NULL },
|
||||||
};
|
};
|
||||||
struct command_table db_show_table = LIST_HEAD_INITIALIZER(db_show_table);
|
struct db_command_table db_show_table = LIST_HEAD_INITIALIZER(db_show_table);
|
||||||
|
|
||||||
static struct command db_cmds[] = {
|
static struct db_command db_cmds[] = {
|
||||||
{ "print", db_print_cmd, 0, NULL },
|
{ "print", db_print_cmd, 0, NULL },
|
||||||
{ "p", db_print_cmd, 0, NULL },
|
{ "p", db_print_cmd, 0, NULL },
|
||||||
{ "examine", db_examine_cmd, CS_SET_DOT, NULL },
|
{ "examine", db_examine_cmd, CS_SET_DOT, NULL },
|
||||||
@ -155,9 +155,9 @@ static struct command db_cmds[] = {
|
|||||||
{ "textdump", db_textdump_cmd, CS_OWN, NULL },
|
{ "textdump", db_textdump_cmd, CS_OWN, NULL },
|
||||||
{ "findstack", db_findstack_cmd, 0, NULL },
|
{ "findstack", db_findstack_cmd, 0, NULL },
|
||||||
};
|
};
|
||||||
struct command_table db_cmd_table = LIST_HEAD_INITIALIZER(db_cmd_table);
|
struct db_command_table db_cmd_table = LIST_HEAD_INITIALIZER(db_cmd_table);
|
||||||
|
|
||||||
static struct command *db_last_command = NULL;
|
static struct db_command *db_last_command = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if 'ed' style: 'dot' is set at start of last item printed,
|
* if 'ed' style: 'dot' is set at start of last item printed,
|
||||||
@ -187,13 +187,13 @@ db_skip_to_eol(void)
|
|||||||
#define CMD_AMBIGUOUS 3
|
#define CMD_AMBIGUOUS 3
|
||||||
#define CMD_HELP 4
|
#define CMD_HELP 4
|
||||||
|
|
||||||
static void db_cmd_match(char *name, struct command *cmd,
|
static void db_cmd_match(char *name, struct db_command *cmd,
|
||||||
struct command **cmdp, int *resultp);
|
struct db_command **cmdp, int *resultp);
|
||||||
static void db_cmd_list(struct command_table *table);
|
static void db_cmd_list(struct db_command_table *table);
|
||||||
static int db_cmd_search(char *name, struct command_table *table,
|
static int db_cmd_search(char *name, struct db_command_table *table,
|
||||||
struct command **cmdp);
|
struct db_command **cmdp);
|
||||||
static void db_command(struct command **last_cmdp,
|
static void db_command(struct db_command **last_cmdp,
|
||||||
struct command_table *cmd_table, int dopager);
|
struct db_command_table *cmd_table, int dopager);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the command lists from the static tables.
|
* Initialize the command lists from the static tables.
|
||||||
@ -220,9 +220,9 @@ db_command_init(void)
|
|||||||
* Register a command.
|
* Register a command.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
db_command_register(struct command_table *list, struct command *cmd)
|
db_command_register(struct db_command_table *list, struct db_command *cmd)
|
||||||
{
|
{
|
||||||
struct command *c, *last;
|
struct db_command *c, *last;
|
||||||
|
|
||||||
last = NULL;
|
last = NULL;
|
||||||
LIST_FOREACH(c, list, next) {
|
LIST_FOREACH(c, list, next) {
|
||||||
@ -251,9 +251,9 @@ db_command_register(struct command_table *list, struct command *cmd)
|
|||||||
* Remove a command previously registered with db_command_register.
|
* Remove a command previously registered with db_command_register.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
db_command_unregister(struct command_table *list, struct command *cmd)
|
db_command_unregister(struct db_command_table *list, struct db_command *cmd)
|
||||||
{
|
{
|
||||||
struct command *c;
|
struct db_command *c;
|
||||||
|
|
||||||
LIST_FOREACH(c, list, next) {
|
LIST_FOREACH(c, list, next) {
|
||||||
if (cmd == c) {
|
if (cmd == c) {
|
||||||
@ -268,7 +268,7 @@ db_command_unregister(struct command_table *list, struct command *cmd)
|
|||||||
* Helper function to match a single command.
|
* Helper function to match a single command.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
db_cmd_match(char *name, struct command *cmd, struct command **cmdp,
|
db_cmd_match(char *name, struct db_command *cmd, struct db_command **cmdp,
|
||||||
int *resultp)
|
int *resultp)
|
||||||
{
|
{
|
||||||
char *lp, *rp;
|
char *lp, *rp;
|
||||||
@ -304,10 +304,11 @@ db_cmd_match(char *name, struct command *cmd, struct command **cmdp,
|
|||||||
* Search for command prefix.
|
* Search for command prefix.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
db_cmd_search(char *name, struct command_table *table, struct command **cmdp)
|
db_cmd_search(char *name, struct db_command_table *table,
|
||||||
|
struct db_command **cmdp)
|
||||||
{
|
{
|
||||||
struct command *cmd;
|
struct db_command *cmd;
|
||||||
int result = CMD_NONE;
|
int result = CMD_NONE;
|
||||||
|
|
||||||
LIST_FOREACH(cmd, table, next) {
|
LIST_FOREACH(cmd, table, next) {
|
||||||
db_cmd_match(name,cmd,cmdp,&result);
|
db_cmd_match(name,cmd,cmdp,&result);
|
||||||
@ -325,9 +326,9 @@ db_cmd_search(char *name, struct command_table *table, struct command **cmdp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
db_cmd_list(struct command_table *table)
|
db_cmd_list(struct db_command_table *table)
|
||||||
{
|
{
|
||||||
struct command *cmd;
|
struct db_command *cmd;
|
||||||
int have_subcommands;
|
int have_subcommands;
|
||||||
|
|
||||||
have_subcommands = 0;
|
have_subcommands = 0;
|
||||||
@ -351,10 +352,10 @@ db_cmd_list(struct command_table *table)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
db_command(struct command **last_cmdp, struct command_table *cmd_table,
|
db_command(struct db_command **last_cmdp, struct db_command_table *cmd_table,
|
||||||
int dopager)
|
int dopager)
|
||||||
{
|
{
|
||||||
struct command *cmd = NULL;
|
struct db_command *cmd = NULL;
|
||||||
int t;
|
int t;
|
||||||
char modif[TOK_STRING_SIZE];
|
char modif[TOK_STRING_SIZE];
|
||||||
db_expr_t addr, count;
|
db_expr_t addr, count;
|
||||||
|
@ -94,11 +94,11 @@ extern vm_offset_t ksymtab, kstrtab, ksymtab_size, ksymtab_relbase;
|
|||||||
* - The last one for sub-commands of 'show all'; type 'show all'
|
* - The last one for sub-commands of 'show all'; type 'show all'
|
||||||
* without any argument to get a list.
|
* without any argument to get a list.
|
||||||
*/
|
*/
|
||||||
struct command;
|
struct db_command;
|
||||||
LIST_HEAD(command_table, command);
|
LIST_HEAD(db_command_table, db_command);
|
||||||
extern struct command_table db_cmd_table;
|
extern struct db_command_table db_cmd_table;
|
||||||
extern struct command_table db_show_table;
|
extern struct db_command_table db_show_table;
|
||||||
extern struct command_table db_show_all_table;
|
extern struct db_command_table db_show_all_table;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Type signature for a function implementing a ddb command.
|
* Type signature for a function implementing a ddb command.
|
||||||
@ -109,7 +109,7 @@ typedef void db_cmdfcn_t(db_expr_t addr, bool have_addr, db_expr_t count,
|
|||||||
/*
|
/*
|
||||||
* Command table entry.
|
* Command table entry.
|
||||||
*/
|
*/
|
||||||
struct command {
|
struct db_command {
|
||||||
char * name; /* command name */
|
char * name; /* command name */
|
||||||
db_cmdfcn_t *fcn; /* function to call */
|
db_cmdfcn_t *fcn; /* function to call */
|
||||||
int flag; /* extra info: */
|
int flag; /* extra info: */
|
||||||
@ -117,8 +117,8 @@ struct command {
|
|||||||
#define CS_MORE 0x2 /* standard syntax, but may have other words
|
#define CS_MORE 0x2 /* standard syntax, but may have other words
|
||||||
* at end */
|
* at end */
|
||||||
#define CS_SET_DOT 0x100 /* set dot after command */
|
#define CS_SET_DOT 0x100 /* set dot after command */
|
||||||
struct command_table *more; /* another level of command */
|
struct db_command_table *more; /* another level of command */
|
||||||
LIST_ENTRY(command) next; /* next entry in the command table */
|
LIST_ENTRY(db_command) next; /* next entry in the command table */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -128,7 +128,7 @@ struct command {
|
|||||||
* the module is loaded.
|
* the module is loaded.
|
||||||
*/
|
*/
|
||||||
#define _DB_SET(_suffix, _name, _func, list, _flag, _more) \
|
#define _DB_SET(_suffix, _name, _func, list, _flag, _more) \
|
||||||
static struct command __CONCAT(_name,_suffix) = { \
|
static struct db_command __CONCAT(_name,_suffix) = { \
|
||||||
.name = __STRING(_name), \
|
.name = __STRING(_name), \
|
||||||
.fcn = _func, \
|
.fcn = _func, \
|
||||||
.flag = _flag, \
|
.flag = _flag, \
|
||||||
@ -225,8 +225,10 @@ bool db_value_of_name(const char *name, db_expr_t *valuep);
|
|||||||
bool db_value_of_name_pcpu(const char *name, db_expr_t *valuep);
|
bool db_value_of_name_pcpu(const char *name, db_expr_t *valuep);
|
||||||
bool db_value_of_name_vnet(const char *name, db_expr_t *valuep);
|
bool db_value_of_name_vnet(const char *name, db_expr_t *valuep);
|
||||||
int db_write_bytes(vm_offset_t addr, size_t size, char *data);
|
int db_write_bytes(vm_offset_t addr, size_t size, char *data);
|
||||||
void db_command_register(struct command_table *, struct command *);
|
void db_command_register(struct db_command_table *,
|
||||||
void db_command_unregister(struct command_table *, struct command *);
|
struct db_command *);
|
||||||
|
void db_command_unregister(struct db_command_table *,
|
||||||
|
struct db_command *);
|
||||||
int db_fetch_ksymtab(vm_offset_t ksym_start, vm_offset_t ksym_end,
|
int db_fetch_ksymtab(vm_offset_t ksym_start, vm_offset_t ksym_end,
|
||||||
vm_offset_t relbase);
|
vm_offset_t relbase);
|
||||||
|
|
||||||
|
@ -12932,7 +12932,7 @@ t4_dump_devlog(struct adapter *sc)
|
|||||||
} while (i != first && !db_pager_quit);
|
} while (i != first && !db_pager_quit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct command_table db_t4_table = LIST_HEAD_INITIALIZER(db_t4_table);
|
static struct db_command_table db_t4_table = LIST_HEAD_INITIALIZER(db_t4_table);
|
||||||
_DB_SET(_show, t4, NULL, db_show_table, 0, &db_t4_table);
|
_DB_SET(_show, t4, NULL, db_show_table, 0, &db_t4_table);
|
||||||
|
|
||||||
DB_FUNC(devlog, db_show_devlog, db_t4_table, CS_OWN, NULL)
|
DB_FUNC(devlog, db_show_devlog, db_t4_table, CS_OWN, NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user