1 /* $NetBSD: db_command.h,v 1.34 2009/01/05 22:19:40 haad Exp $ */
4 * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Mach Operating System
34 * Copyright (c) 1991,1990 Carnegie Mellon University
35 * All Rights Reserved.
37 * Permission to use, copy, modify and distribute this software and its
38 * documentation is hereby granted, provided that both the copyright
39 * notice and this permission notice appear in all copies of the
40 * software, derivative works or modified versions, and any portions
41 * thereof, and that both notices appear in supporting documentation.
43 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
44 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
45 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 * Carnegie Mellon requests users of this software to return to
49 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
50 * School of Computer Science
51 * Carnegie Mellon University
52 * Pittsburgh PA 15213-3890
54 * any improvements or extensions that they make and grant Carnegie the
55 * rights to redistribute these changes.
57 * Author: David B. Golub, Carnegie Mellon University
64 void db_skip_to_eol(void);
65 void db_command_loop(void);
66 void db_error(const char *) __dead
;
68 extern db_addr_t db_dot
; /* current location */
69 extern db_addr_t db_last_addr
; /* last explicit address typed */
70 extern db_addr_t db_prev
; /* last address examined
72 extern db_addr_t db_next
; /* next address to be examined
75 extern char db_cmd_on_enter
[];
82 * Macro include help when DDB_VERBOSE_HELP option(9) is used
84 #ifdef DDB_VERBOSE_HELP
85 #define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
86 name,funct,type,cmd_descr,cmd_arg,arg_desc
88 #define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
95 * we have two types of lists one for base commands like reboot
96 * and another list for show subcommands.
99 #define DDB_BASE_CMD 0
100 #define DDB_SHOW_CMD 1
101 #define DDB_MACH_CMD 2
104 int db_register_tbl(uint8_t, const struct db_command
*);
105 int db_unregister_tbl(uint8_t, const struct db_command
*);
111 const char *name
; /* command name */
113 /* function to call */
114 void (*fcn
)(db_expr_t
, bool, db_expr_t
, const char *);
116 * Flag is used for modifing command behaviour.
117 * CS_OWN && CS_MORE are specify type of command arguments.
118 * CS_OWN commandmanage arguments in own way.
119 * CS_MORE db_command() prepare argument list.
121 * CS_COMPAT is set for all level 2 commands with level 3 childs (show all pages)
123 * CS_SHOW identify show command in BASE command list
124 * CS_MACH identify mach command in BASE command list
126 * CS_SET_DOT specify if this command is put to last added command memory.
127 * CS_NOREPEAT this command does not repeat
129 uint16_t flag
; /* extra info: */
130 #define CS_OWN 0x1 /* non-standard syntax */
131 #define CS_MORE 0x2 /* standard syntax, but may have other
133 #define CS_COMPAT 0x4 /* is set for compatibilty with old
135 #define CS_SHOW 0x8 /* select show list */
136 #define CS_MACH 0x10 /* select machine dependent list */
138 #define CS_SET_DOT 0x100 /* set dot after command */
139 #define CS_NOREPEAT 0x200 /* don't set last_command */
140 #ifdef DDB_VERBOSE_HELP
141 const char *cmd_descr
; /* description of command */
142 const char *cmd_arg
; /* command arguments */
143 const char *cmd_arg_help
; /* arguments description */
147 void *db_alloc(size_t);
148 void *db_zalloc(size_t);
149 void db_free(void *, size_t);
151 #endif /*_DDB_COMMAND_*/