xref: /freebsd/share/man/man9/DB_COMMAND.9 (revision 1e9469d188355e00de1c3811dd2f983d2f5a47d9)
15a2637d2SSam Leffler.\"-
25a2637d2SSam Leffler.\" Copyright (c) 2008 Guillaume Ballet
35a2637d2SSam Leffler.\" All rights reserved.
45a2637d2SSam Leffler.\"
55a2637d2SSam Leffler.\" Redistribution and use in source and binary forms, with or without
65a2637d2SSam Leffler.\" modification, are permitted provided that the following conditions
75a2637d2SSam Leffler.\" are met:
85a2637d2SSam Leffler.\" 1. Redistributions of source code must retain the above copyright
95a2637d2SSam Leffler.\"    notice, this list of conditions and the following disclaimer.
105a2637d2SSam Leffler.\" 2. Redistributions in binary form must reproduce the above copyright
115a2637d2SSam Leffler.\"    notice, this list of conditions and the following disclaimer in the
125a2637d2SSam Leffler.\"    documentation and/or other materials provided with the distribution.
135a2637d2SSam Leffler.\"
145a2637d2SSam Leffler.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
155a2637d2SSam Leffler.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
165a2637d2SSam Leffler.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
175a2637d2SSam Leffler.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
185a2637d2SSam Leffler.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
195a2637d2SSam Leffler.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
205a2637d2SSam Leffler.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
215a2637d2SSam Leffler.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
225a2637d2SSam Leffler.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
235a2637d2SSam Leffler.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
245a2637d2SSam Leffler.\" SUCH DAMAGE.
255a2637d2SSam Leffler.\"
265a2637d2SSam Leffler.\" $FreeBSD$
275a2637d2SSam Leffler.\"
285a2637d2SSam Leffler.Dd August 27, 2008
295a2637d2SSam Leffler.Dt DB_COMMAND 9
305a2637d2SSam Leffler.Os
315a2637d2SSam Leffler.Sh NAME
325a2637d2SSam Leffler.Nm DB_COMMAND ,
335a2637d2SSam Leffler.Nm DB_SHOW_COMMAND ,
345a2637d2SSam Leffler.Nm DB_SHOW_ALL_COMMAND
3573bbeaa5SGlen Barber.Nd Extends the ddb command set
365a2637d2SSam Leffler.Sh SYNOPSIS
375a2637d2SSam Leffler.In ddb/ddb.h
385a2637d2SSam Leffler.Fo DB_COMMAND
395a2637d2SSam Leffler.Fa command_name
405a2637d2SSam Leffler.Fa command_function
415a2637d2SSam Leffler.Fc
425a2637d2SSam Leffler.Fn DB_SHOW_COMMAND "command_name" "command_function"
435a2637d2SSam Leffler.Fn DB_SHOW_ALL_COMMAND "command_name" "command_function"
445a2637d2SSam Leffler.Sh DESCRIPTION
455a2637d2SSam LefflerThe
465a2637d2SSam Leffler.Fn DB_COMMAND
475a2637d2SSam Lefflermacro adds
485a2637d2SSam Leffler.Fa command_name
495a2637d2SSam Lefflerto the list of top-level commands.
505a2637d2SSam LefflerInvoking
515a2637d2SSam Leffler.Fa command_name
525a2637d2SSam Lefflerfrom ddb will call
535a2637d2SSam Leffler.Fa command_function .
545a2637d2SSam Leffler.Pp
555a2637d2SSam LefflerThe
565a2637d2SSam Leffler.Fn DB_SHOW_COMMAND
575a2637d2SSam Lefflerand
585a2637d2SSam Leffler.Fn DB_SHOW_ALL_COMMAND
595a2637d2SSam Lefflerare roughly equivalent to
605a2637d2SSam Leffler.Fn DB_COMMAND
615a2637d2SSam Lefflerbut in these cases,
625a2637d2SSam Leffler.Fa command_name
635a2637d2SSam Leffleris a sub-command of the ddb
645a2637d2SSam Leffler.Sy show
655a2637d2SSam Lefflercommand and
665a2637d2SSam Leffler.Sy show all
675a2637d2SSam Lefflercommand, respectively.
685a2637d2SSam Leffler.Pp
695a2637d2SSam LefflerThe general command syntax:
705a2637d2SSam Leffler.Cm command Ns Op Li \&/ Ns Ar modifier
71*1e9469d1SChristian Brueffer.Ar address Ns Op , Ns Ar count ,
725a2637d2SSam Lefflertranslates into the following parameters for
735a2637d2SSam Leffler.Fa command_function :
749255dffdSGlen Barber.Bl -tag -width Fa -offset indent
755a2637d2SSam Leffler.It Fa addr
765a2637d2SSam LefflerThe address passed to the command as an argument.
775a2637d2SSam Leffler.It Fa have_addr
785a2637d2SSam LefflerA boolean value that is true if the addr field is valid.
795a2637d2SSam Leffler.It Fa count
805a2637d2SSam LefflerThe number of quad words starting at offset
815a2637d2SSam Leffler.Fa addr
825a2637d2SSam Lefflerthat the command must process.
835a2637d2SSam Leffler.It Fa modif
845a2637d2SSam LefflerA pointer to the string of modifiers. That is, a series of symbols used to pass some options to the command. For example, the
855a2637d2SSam Leffler.Sy examine
865a2637d2SSam Lefflercommand will display words in decimal form if it is passed the modifier "d".
875a2637d2SSam Leffler.El
885a2637d2SSam Leffler.Sh EXAMPLE
895a2637d2SSam LefflerIn your module, the command is declared as:
905a2637d2SSam Leffler.Bd -literal
915a2637d2SSam LefflerDB_COMMAND(mycmd, my_cmd_func)
925a2637d2SSam Leffler{
935a2637d2SSam Leffler	if (have_addr)
945a2637d2SSam Leffler		db_printf("Calling my command with address %p\\n", addr);
955a2637d2SSam Leffler}
965a2637d2SSam Leffler.Ed
975a2637d2SSam Leffler.Pp
985a2637d2SSam LefflerThen, when in ddb:
995a2637d2SSam Leffler.Bd -literal
1005a2637d2SSam Leffler.Bf Sy
1015a2637d2SSam Lefflerdb> mycmd 0x1000
1025a2637d2SSam LefflerCalling my command with address 0x1000
1035a2637d2SSam Lefflerdb>
1045a2637d2SSam Leffler.Ef
1055a2637d2SSam Leffler.Ed
1068a7314fcSBaptiste Daroussin.Sh SEE ALSO
1075a2637d2SSam Leffler.Xr ddb 4
1088a7314fcSBaptiste Daroussin.Sh AUTHORS
1095a2637d2SSam LefflerThis manual page was written by
1108a7314fcSBaptiste Daroussin.An Guillaume Ballet Aq Mt gballet@gmail.com .
111