DB_COMMAND (9)
Leading comments
- Copyright (c) 2008 Guillaume Ballet All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentat...
NAME
DB_COMMAND DB_SHOW_COMMAND DB_SHOW_ALL_COMMAND - Extends the ddb command setSYNOPSIS
In ddb/ddb.h Fo DB_COMMAND Fa command_name Fa command_function Fc Fn DB_SHOW_COMMAND command_name command_function Fn DB_SHOW_ALL_COMMAND command_name command_functionDESCRIPTION
The Fn DB_COMMAND macro adds Fa command_name to the list of top-level commands. Invoking Fa command_name from ddb will call Fa command_function .The Fn DB_SHOW_COMMAND and Fn DB_SHOW_ALL_COMMAND are roughly equivalent to Fn DB_COMMAND but in these cases, Fa command_name is a sub-command of the ddb show command and show all command, respectively.
The general command syntax: command [/ modifier ] address [, count ] translates into the following parameters for Fa command_function :
- Fa addr
- The address passed to the command as an argument.
- Fa have_addr
- A boolean value that is true if the addr field is valid.
- Fa count
- The number of quad words starting at offset Fa addr that the command must process.
- Fa 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".
EXAMPLE
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\n", addr); }
Then, when in ddb:
Bf Sy db> mycmd 0x1000 Calling my command with address 0x1000 db> Ef