tail head cat sleep
QR code linking to this page

Manual Pages  — DB_COMMAND

NAME

DB_COMMAND, DB_COMMAND_FLAGS, DB_SHOW_COMMAND, DB_SHOW_COMMAND_FLAGS, DB_SHOW_ALL_COMMAND, DB_TABLE_COMMAND, DB_TABLE_COMMAND_FLAGS, DB_ALIAS, DB_ALIAS_FLAGS, DB_SHOW_ALIAS, DB_SHOW_ALIAS_FLAGS, DB_SHOW_ALL_ALIAS, DB_TABLE_ALIAS, DB_TABLE_ALIAS_FLAGS DB_DECLARE_TABLE, DB_DEFINE_TABLE, – Extends the ddb command set

CONTENTS

SYNOPSIS

#include <ddb/ddb.h>

DB_COMMAND(command_name, command_function);

DB_COMMAND_FLAGS(command_name, command_function, flags);

DB_SHOW_COMMAND(command_name, command_function);

DB_SHOW_COMMAND_FLAGS(command_name, command_function, flags);

DB_SHOW_ALL_COMMAND(command_name, command_function);

DB_TABLE_COMMAND(table, command_name, command_function);

DB_TABLE_COMMAND_FLAGS(table, command_name, command_function, flags);

DB_ALIAS(alias_name, command_function);

DB_ALIAS_FLAGS(alias_name, command_function, flags);

DB_SHOW_ALIAS(alias_name, command_function);

DB_SHOW_ALIAS_FLAGS(alias_name, command_function, flags);

DB_SHOW_ALL_ALIAS(alias_name, command_function);

DB_TABLE_ALIAS(table, alias_name, command_function);

DB_TABLE_ALIAS_FLAGS(table, alias_name, command_function, flags);

DB_DEFINE_TABLE(parent, name, table);

DB_DECLARE_TABLE(table);

DESCRIPTION

The DB_COMMAND() macro adds command_name to the list of top-level commands. Invoking command_name from ddb will call command_function.

The DB_SHOW_COMMAND() and DB_SHOW_ALL_COMMAND() macros are roughly equivalent to DB_COMMAND() but in these cases, command_name is a sub-command of the ddb show command and show all command, respectively.

The DB_TABLE_COMMAND() macro is also similar to DB_COMMAND() but adds the new command as a sub-command of the ddb command table.

The DB_ALIAS(), DB_SHOW_ALIAS(), DB_SHOW_ALL_ALIAS(), and DB_TABLE_ALIAS() macros register the existing command_function under the alternative command name alias_name.

The _FLAGS variants of these commands allow the programmer to specify a value for the flag field of the command structure. The possible flag values are defined alongside struct db_command in <ddb/ddb.h>.

The general command syntax: command[amp;/modifier] address[,count], translates into the following parameters for command_function:
addr
  The address passed to the command as an argument.
have_addr
  A boolean value that is true if the addr field is valid.
count
  The number of quad words starting at offset addr that the command must process.
modif
  A pointer to the string of modifiers. That is, a series of symbols used to pass some options to the command. For example, the examine command will display words in decimal form if it is passed the modifier "d".

The DB_DEFINE_TABLE() macro adds a new command name as a sub-command of the existing command table parent. The new command defines a table named table which contains sub-commands. New commands and aliases can be added to this table by passing table as the first argument to one of the DB_TABLE_ macros.

EXAMPLES

In your module, the command is declared as:
DB_COMMAND(mycmd, my_cmd_func)
{
        if (have_addr)
                db_printf("Calling my command with address %p , addr);
}

An alias for this command is declared as:

DB_ALIAS(mycmd2, my_cmd_func);

Then, when in ddb:

db> mycmd 0x1000
Calling my command with address 0x1000
db> mycmd2 0x2500
Calling my command with address 0x2500
db>

SEE ALSO

ddb(4)

AUTHORS

This manual page was written by Guillaume Ballet <Mt gballet@gmail.com>.

DB_COMMAND (9) July 5, 2023

tail head cat sleep
QR code linking to this page


Please direct any comments about this manual page service to Ben Bullock. Privacy policy.

There are 10 types of people in the world: those who understand binary, and those who don't.