Fri Oct 30 06:59:43 2020 UTC ()
Whitespace


(skrll)
diff -r1.39 -r1.40 src/sys/ddb/db_command.h

cvs diff -r1.39 -r1.40 src/sys/ddb/db_command.h (switch to unified diff)

--- src/sys/ddb/db_command.h 2020/10/30 06:57:08 1.39
+++ src/sys/ddb/db_command.h 2020/10/30 06:59:43 1.40
@@ -1,156 +1,156 @@ @@ -1,156 +1,156 @@
1/* $NetBSD: db_command.h,v 1.39 2020/10/30 06:57:08 skrll Exp $ */ 1/* $NetBSD: db_command.h,v 1.40 2020/10/30 06:59:43 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Adam Hamsik. 8 * by Adam Hamsik.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 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 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 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 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 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 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 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Mach Operating System 33 * Mach Operating System
34 * Copyright (c) 1991,1990 Carnegie Mellon University 34 * Copyright (c) 1991,1990 Carnegie Mellon University
35 * All Rights Reserved. 35 * All Rights Reserved.
36 * 36 *
37 * Permission to use, copy, modify and distribute this software and its 37 * Permission to use, copy, modify and distribute this software and its
38 * documentation is hereby granted, provided that both the copyright 38 * documentation is hereby granted, provided that both the copyright
39 * notice and this permission notice appear in all copies of the 39 * notice and this permission notice appear in all copies of the
40 * software, derivative works or modified versions, and any portions 40 * software, derivative works or modified versions, and any portions
41 * thereof, and that both notices appear in supporting documentation. 41 * thereof, and that both notices appear in supporting documentation.
42 * 42 *
43 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 43 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
44 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 44 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
45 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 45 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
46 * 46 *
47 * Carnegie Mellon requests users of this software to return to 47 * Carnegie Mellon requests users of this software to return to
48 * 48 *
49 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 49 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
50 * School of Computer Science 50 * School of Computer Science
51 * Carnegie Mellon University 51 * Carnegie Mellon University
52 * Pittsburgh PA 15213-3890 52 * Pittsburgh PA 15213-3890
53 * 53 *
54 * any improvements or extensions that they make and grant Carnegie the 54 * any improvements or extensions that they make and grant Carnegie the
55 * rights to redistribute these changes. 55 * rights to redistribute these changes.
56 * 56 *
57 * Author: David B. Golub, Carnegie Mellon University 57 * Author: David B. Golub, Carnegie Mellon University
58 * Date: 7/90 58 * Date: 7/90
59 */ 59 */
60 60
61#ifndef _DDB_COMMAND_ 61#ifndef _DDB_COMMAND_
62#define _DDB_COMMAND_ 62#define _DDB_COMMAND_
63 63
64void db_skip_to_eol(void); 64void db_skip_to_eol(void);
65void db_command_loop(void); 65void db_command_loop(void);
66void db_error(const char *) __dead; 66void db_error(const char *) __dead;
67 67
68extern db_addr_t db_dot; /* current location */ 68extern db_addr_t db_dot; /* current location */
69extern db_addr_t db_last_addr; /* last explicit address typed */ 69extern db_addr_t db_last_addr; /* last explicit address typed */
70extern db_addr_t db_prev; /* last address examined 70extern db_addr_t db_prev; /* last address examined
71 or written */ 71 or written */
72extern db_addr_t db_next; /* next address to be examined 72extern db_addr_t db_next; /* next address to be examined
73 or written */ 73 or written */
74 74
75extern char db_cmd_on_enter[]; 75extern char db_cmd_on_enter[];
76 76
77struct db_command; 77struct db_command;
78 78
79 79
80 80
81/* 81/*
82 * Macro include help when DDB_VERBOSE_HELP option(9) is used 82 * Macro include help when DDB_VERBOSE_HELP option(9) is used
83 */ 83 */
84#ifdef DDB_VERBOSE_HELP 84#ifdef DDB_VERBOSE_HELP
85#define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\ 85#define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
86 name,funct,type,cmd_descr,cmd_arg,arg_desc 86 name,funct,type,cmd_descr,cmd_arg,arg_desc
87#else 87#else
88#define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\ 88#define DDB_ADD_CMD(name,funct,type,cmd_descr,cmd_arg,arg_desc)\
89 name,funct,type 89 name,funct,type
90#endif 90#endif
91 91
92 92
93 93
94/* 94/*
95 * we have two types of lists one for base commands like reboot 95 * we have two types of lists one for base commands like reboot
96 * and another list for show subcommands. 96 * and another list for show subcommands.
97 */ 97 */
98 98
99#define DDB_BASE_CMD 0 99#define DDB_BASE_CMD 0
100#define DDB_SHOW_CMD 1 100#define DDB_SHOW_CMD 1
101#define DDB_MACH_CMD 2 101#define DDB_MACH_CMD 2
102 102
103 103
104int db_register_tbl(uint8_t, const struct db_command *); 104int db_register_tbl(uint8_t, const struct db_command *);
105int db_unregister_tbl(uint8_t, const struct db_command *); 105int db_unregister_tbl(uint8_t, const struct db_command *);
106 106
107/* 107/*
108 * Command table 108 * Command table
109 */ 109 */
110struct db_command { 110struct db_command {
111 const char *name; /* command name */ 111 const char *name; /* command name */
112 112
113 /* function to call */ 113 /* function to call */
114 void (*fcn)(db_expr_t, bool, db_expr_t, const char *); 114 void (*fcn)(db_expr_t, bool, db_expr_t, const char *);
115 /* 115 /*
116 * Flag is used for modifing command behaviour. 116 * Flag is used for modifing command behaviour.
117 * CS_OWN && CS_MORE are specify type of command arguments. 117 * CS_OWN && CS_MORE are specify type of command arguments.
118 * CS_OWN commandmanage arguments in own way. 118 * CS_OWN commandmanage arguments in own way.
119 * CS_MORE db_command() prepare argument list. 119 * CS_MORE db_command() prepare argument list.
120 * 120 *
121 * CS_COMPAT is set for all level 2 commands with level 3 childs (show all pages) 121 * CS_COMPAT is set for all level 2 commands with level 3 childs (show all pages)
122 * 122 *
123 * CS_SHOW identify show command in BASE command list 123 * CS_SHOW identify show command in BASE command list
124 * CS_MACH identify mach command in BASE command list 124 * CS_MACH identify mach command in BASE command list
125 * 125 *
126 * CS_SET_DOT specify if this command is put to last added command memory. 126 * CS_SET_DOT specify if this command is put to last added command memory.
127 * CS_NOREPEAT this command does not repeat 127 * CS_NOREPEAT this command does not repeat
128 */ 128 */
129 uint16_t flag; /* extra info: */ 129 uint16_t flag; /* extra info: */
130#define CS_OWN 0x1 /* non-standard syntax */ 130#define CS_OWN 0x1 /* non-standard syntax */
131#define CS_MORE 0x2 /* standard syntax, but may have other 131#define CS_MORE 0x2 /* standard syntax, but may have other
132 words at end */ 132 words at end */
133#define CS_COMPAT 0x4 /* is set for compatibilty with old 133#define CS_COMPAT 0x4 /* is set for compatibilty with old
134 ddb versions*/ 134 ddb versions */
135#define CS_SHOW 0x8 /* select show list */ 135#define CS_SHOW 0x8 /* select show list */
136#define CS_MACH 0x10 /* select machine dependent list */ 136#define CS_MACH 0x10 /* select machine dependent list */
137 137
138#define CS_SET_DOT 0x100 /* set dot after command */ 138#define CS_SET_DOT 0x100 /* set dot after command */
139#define CS_NOREPEAT 0x200 /* don't set last_command */ 139#define CS_NOREPEAT 0x200 /* don't set last_command */
140#ifdef DDB_VERBOSE_HELP 140#ifdef DDB_VERBOSE_HELP
141 const char *cmd_descr; /* description of command */ 141 const char *cmd_descr; /* description of command */
142 const char *cmd_arg; /* command arguments */ 142 const char *cmd_arg; /* command arguments */
143 const char *cmd_arg_help; /* arguments description */ 143 const char *cmd_arg_help; /* arguments description */
144#endif 144#endif
145}; 145};
146 146
147void *db_alloc(size_t); 147void *db_alloc(size_t);
148void *db_zalloc(size_t); 148void *db_zalloc(size_t);
149void db_free(void *, size_t); 149void db_free(void *, size_t);
150 150
151#ifndef _KERNEL 151#ifndef _KERNEL
152#define db_kernelonly() \ 152#define db_kernelonly() \
153 db_printf("%s: can only be used in-kernel.\n", __func__) 153 db_printf("%s: can only be used in-kernel.\n", __func__)
154#endif 154#endif
155 155
156#endif /*_DDB_COMMAND_*/ 156#endif /*_DDB_COMMAND_*/