2008-09-15 23:13:29 +00:00
|
|
|
.\"-
|
|
|
|
.\" 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
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.Dd August 27, 2008
|
|
|
|
.Dt DB_COMMAND 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm DB_COMMAND ,
|
|
|
|
.Nm DB_SHOW_COMMAND ,
|
|
|
|
.Nm DB_SHOW_ALL_COMMAND
|
2012-05-20 16:43:47 +00:00
|
|
|
.Nd Extends the ddb command set
|
2008-09-15 23:13:29 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In ddb/ddb.h
|
|
|
|
.Fo DB_COMMAND
|
|
|
|
.Fa command_name
|
|
|
|
.Fa command_function
|
2012-03-29 05:02:12 +00:00
|
|
|
.Fc
|
|
|
|
.Fn DB_SHOW_COMMAND "command_name" "command_function"
|
|
|
|
.Fn DB_SHOW_ALL_COMMAND "command_name" "command_function"
|
2008-09-15 23:13:29 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn DB_COMMAND
|
|
|
|
macro adds
|
|
|
|
.Fa command_name
|
|
|
|
to the list of top-level commands.
|
2012-03-29 05:02:12 +00:00
|
|
|
Invoking
|
2008-09-15 23:13:29 +00:00
|
|
|
.Fa command_name
|
2012-03-29 05:02:12 +00:00
|
|
|
from ddb will call
|
2008-09-15 23:13:29 +00:00
|
|
|
.Fa command_function .
|
|
|
|
.Pp
|
|
|
|
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
|
2012-03-29 05:02:12 +00:00
|
|
|
is a sub-command of the ddb
|
2008-09-15 23:13:29 +00:00
|
|
|
.Sy show
|
|
|
|
command and
|
|
|
|
.Sy show all
|
|
|
|
command, respectively.
|
|
|
|
.Pp
|
|
|
|
The general command syntax:
|
2012-03-29 05:02:12 +00:00
|
|
|
.Cm command Ns Op Li \&/ Ns Ar modifier
|
2008-09-15 23:13:29 +00:00
|
|
|
.Ar address Ns Op Li , Ns Ar count ,
|
|
|
|
translates into the following parameters for
|
|
|
|
.Fa command_function :
|
2012-05-12 20:08:16 +00:00
|
|
|
.Bl -tag -width Fa -offset indent
|
2008-09-15 23:13:29 +00:00
|
|
|
.It Fa addr
|
|
|
|
The address passed to the command as an argument.
|
|
|
|
.It Fa have_addr
|
|
|
|
A boolean value that is true if the addr field is valid.
|
|
|
|
.It Fa count
|
|
|
|
The number of quad words starting at offset
|
|
|
|
.Fa addr
|
|
|
|
that the command must process.
|
|
|
|
.It 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
|
|
|
|
.Sy examine
|
|
|
|
command will display words in decimal form if it is passed the modifier "d".
|
|
|
|
.El
|
|
|
|
.Sh EXAMPLE
|
|
|
|
In your module, the command is declared as:
|
|
|
|
.Bd -literal
|
|
|
|
DB_COMMAND(mycmd, my_cmd_func)
|
|
|
|
{
|
|
|
|
if (have_addr)
|
|
|
|
db_printf("Calling my command with address %p\\n", addr);
|
|
|
|
}
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Then, when in ddb:
|
|
|
|
.Bd -literal
|
|
|
|
.Bf Sy
|
|
|
|
db> mycmd 0x1000
|
|
|
|
Calling my command with address 0x1000
|
|
|
|
db>
|
|
|
|
.Ef
|
|
|
|
.Ed
|
2014-06-26 21:44:30 +00:00
|
|
|
.Sh SEE ALSO
|
2008-09-15 23:13:29 +00:00
|
|
|
.Xr ddb 4
|
2014-06-26 21:44:30 +00:00
|
|
|
.Sh AUTHORS
|
2008-09-15 23:13:29 +00:00
|
|
|
This manual page was written by
|
2014-06-26 21:44:30 +00:00
|
|
|
.An Guillaume Ballet Aq Mt gballet@gmail.com .
|