summaryrefslogtreecommitdiffstats
path: root/sys/ddb/ddb.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-03-07 22:17:06 +0000
committerjhb <jhb@FreeBSD.org>2006-03-07 22:17:06 +0000
commitd40196102f6bb67f69cec98428b3c3d127203f54 (patch)
treebbc23894e24c03f318255819678acf2a216b9cd5 /sys/ddb/ddb.h
parent13d9bffa825005efe48317fcc02c663f2bbd263c (diff)
downloadFreeBSD-src-d40196102f6bb67f69cec98428b3c3d127203f54.zip
FreeBSD-src-d40196102f6bb67f69cec98428b3c3d127203f54.tar.gz
Clean up the way we handle auxiliary commands for a given ddb command
table. Previously, the ddb code knew of each linker set of auxiliary commands and which explicit command list they were tied to. These changes add a simple command_table struct that contains both the static list of commands and the pointers for any auxiliary linker set of additional commands. This also makes it possible for other arbitrary command tables to be defined in other parts of the kernel w/o having to edit ddb itself. The DB_SET macro has also been trimmed down to just creating an entry in a linker set. A new DB_FUNC macro does what the old DB_SET did which is to not only add an entry to the linker set but also to include a function prototype for the function being added. With these changes, it's now also possible to create aliases for ddb functions using DB_SET() directly if desired.
Diffstat (limited to 'sys/ddb/ddb.h')
-rw-r--r--sys/ddb/ddb.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h
index 45f9213..33021c9 100644
--- a/sys/ddb/ddb.h
+++ b/sys/ddb/ddb.h
@@ -55,20 +55,23 @@ typedef void db_cmdfcn_t(db_expr_t addr, boolean_t have_addr, db_expr_t count,
typedef void db_page_calloutfcn_t(void *arg);
#define DB_COMMAND(cmd_name, func_name) \
- DB_SET(cmd_name, func_name, db_cmd_set, 0, NULL)
+ DB_FUNC(cmd_name, func_name, db_cmd_set, 0, NULL)
#define DB_SHOW_COMMAND(cmd_name, func_name) \
- DB_SET(cmd_name, func_name, db_show_cmd_set, 0, NULL)
+ DB_FUNC(cmd_name, func_name, db_show_cmd_set, 0, NULL)
-#define DB_SET(cmd_name, func_name, set, flag, more) \
-static db_cmdfcn_t func_name; \
- \
-static const struct command __CONCAT(func_name,_cmd) = { \
+#define DB_SET(cmd_name, func_name, set, flag, more) \
+static const struct command __CONCAT(cmd_name,_cmd) = { \
__STRING(cmd_name), \
func_name, \
flag, \
more \
}; \
-TEXT_SET(set, __CONCAT(func_name,_cmd)); \
+TEXT_SET(set, __CONCAT(cmd_name,_cmd))
+
+#define DB_FUNC(cmd_name, func_name, set, flag, more) \
+static db_cmdfcn_t func_name; \
+ \
+DB_SET(cmd_name, func_name, set, flag, more); \
\
static void \
func_name(addr, have_addr, count, modif) \
@@ -149,6 +152,14 @@ db_page_calloutfcn_t db_simple_pager;
/*
* Command table.
*/
+struct command;
+
+struct command_table {
+ struct command *table;
+ struct command **aux_tablep;
+ struct command **aux_tablep_end;
+};
+
struct command {
char * name; /* command name */
db_cmdfcn_t *fcn; /* function to call */
@@ -157,7 +168,7 @@ struct command {
#define CS_MORE 0x2 /* standard syntax, but may have other words
* at end */
#define CS_SET_DOT 0x100 /* set dot after command */
- struct command *more; /* another level of command */
+ struct command_table *more; /* another level of command */
};
#endif /* !_DDB_DDB_H_ */
OpenPOWER on IntegriCloud