| DDB(9) | Kernel Developer's Manual | DDB(9) |
ddb — in-kernel
debugger
#include
<ddb/ddb.h>
int
db_register_tbl(uint8_t
type, const struct
db_command *commands);
int
db_unregister_tbl(uint8_t
type, const struct
db_command *commands);
void
(*pf)(db_expr_t addr,
bool have_addr, db_expr_t count,
const char *modif);
DDB_ADD_CMD(const char
*name, void (*pf)(db_expr_t, bool, db_expr_t, const
char *), uint16_t flags, const
char *cmd_descr, const char *cmd_arg,
const char *arg_desc);
Devices and kernel modules can add new commands to the
ddb(4) in-kernel debugger with
db_register_tbl()
and remove previously added commands with
db_unregister_tbl()
respectively.
The type argument is one of:
DDB_BASE_CMDDDB_MACH_CMDmach command;DDB_SHOW_CMDshow command.The commands argument is an
array of struct db_command entries. The initializer
list for the array should use the
DDB_ADD_CMD()
macro for its entries. The name argument is the name
of the debugger command. An entry with NULL
name terminates the array.
The pf argument is the function that implements the command. The debugger's REPL parses the usual command format documented in ddb(4) and invokes the implementation with the values obtained.
The flags argument is a bitwise OR of the following values:
CS_MORECS_NOREPEATCS_OWNCS_SET_DOTThe remaining parameters are strings that provide documentation
for the command and its arguments. That documentation is available to the
user via the help command if the kernel was compiled
with the DDB_VERBOSE_HELP option.
| October 30, 2020 | NetBSD 11.0 |