]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_variables.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / ddb / db_variables.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33 /*
34 * HISTORY
35 *
36 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
37 * Import of Mac OS X kernel (~semeria)
38 *
39 * Revision 1.1.1.1 1998/03/07 02:26:09 wsanchez
40 * Import of OSF Mach kernel (~mburg)
41 *
42 * Revision 1.2.17.5 1996/01/09 19:16:39 devrcs
43 * Define alternate register definitions.
44 * [1995/12/01 21:42:46 jfraser]
45 *
46 * Merged '64-bit safe' changes from DEC alpha port.
47 * [1995/11/21 18:04:00 jfraser]
48 *
49 * Revision 1.2.17.4 1995/02/23 21:44:00 alanl
50 * Merged with DIPC2_SHARED.
51 * [1995/01/05 13:36:23 alanl]
52 *
53 * Revision 1.2.20.2 1994/10/14 03:47:19 dwm
54 * mk6 CR668 - 1.3b26 merge
55 * 64bit cleanup
56 * [1994/10/14 03:40:00 dwm]
57 *
58 * Revision 1.2.17.2 1994/09/23 01:22:42 ezf
59 * change marker to not FREE
60 * [1994/09/22 21:11:29 ezf]
61 *
62 * Revision 1.2.17.1 1994/06/11 21:12:42 bolinger
63 * Merge up to NMK17.2.
64 * [1994/06/11 20:04:23 bolinger]
65 *
66 * Revision 1.2.22.1 1994/12/06 19:43:29 alanl
67 * Intel merge, Oct 94 code drop.
68 * Define DB_VAR_NULL.
69 * Add prototype for db_find_reg_name.
70 * [94/11/23 mmp]
71 *
72 * Revision 1.2.15.1 1994/02/08 10:59:16 bernadat
73 * Added db_show_one_variable & db_show_variable prototypes
74 *
75 * Got DB_MACRO_LEVEL and DB_MACRO_NARGS macros from <ddb/db_variables.h>.
76 * Added new fields (hidden_xxx) into struct db_variable and into
77 * struct db_var_aux_param.
78 * Added DB_VAR_SHOW for showing variables.
79 * [93/08/12 paire]
80 * [94/02/07 bernadat]
81 *
82 * Revision 1.2.4.3 1993/07/27 18:28:29 elliston
83 * Add ANSI prototypes. CR #9523.
84 * [1993/07/27 18:13:26 elliston]
85 *
86 * Revision 1.2.4.2 1993/06/09 02:21:06 gm
87 * Added to OSF/1 R1.3 from NMK15.0.
88 * [1993/06/02 20:57:48 jeffc]
89 *
90 * Revision 1.2 1993/04/19 16:03:36 devrcs
91 * New field used to display old register values with 'set' command
92 * [barbou@gr.osf.org]
93 * [92/12/03 bernadat]
94 *
95 * Revision 1.1 1992/09/30 02:24:26 robert
96 * Initial revision
97 *
98 * $EndLog$
99 */
100 /* CMU_HIST */
101 /*
102 * Revision 2.5 91/10/09 16:04:17 af
103 * Revision 2.4.3.1 91/10/05 13:08:42 jeffreyh
104 * Added suffix related field to db_variable structure.
105 * Added macro definitions of db_{read,write}_variable.
106 * [91/08/29 tak]
107 *
108 * Revision 2.4.3.1 91/10/05 13:08:42 jeffreyh
109 * Added suffix related field to db_variable structure.
110 * Added macro definitions of db_{read,write}_variable.
111 * [91/08/29 tak]
112 *
113 * Revision 2.4 91/05/14 15:37:12 mrt
114 * Correcting copyright
115 *
116 * Revision 2.3 91/02/05 17:07:23 mrt
117 * Changed to new Mach copyright
118 * [91/01/31 16:19:54 mrt]
119 *
120 * Revision 2.2 90/08/27 21:53:40 dbg
121 * Modularized typedef name. Documented the calling sequence of
122 * the (optional) access function of a variable. Now the valuep
123 * field can be made opaque, eg be an offset that fcn() resolves.
124 * [90/08/20 af]
125 *
126 * Created.
127 * [90/07/25 dbg]
128 *
129 */
130 /* CMU_ENDHIST */
131 /*
132 * Mach Operating System
133 * Copyright (c) 1991,1990 Carnegie Mellon University
134 * All Rights Reserved.
135 *
136 * Permission to use, copy, modify and distribute this software and its
137 * documentation is hereby granted, provided that both the copyright
138 * notice and this permission notice appear in all copies of the
139 * software, derivative works or modified versions, and any portions
140 * thereof, and that both notices appear in supporting documentation.
141 *
142 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
143 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
144 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
145 *
146 * Carnegie Mellon requests users of this software to return to
147 *
148 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
149 * School of Computer Science
150 * Carnegie Mellon University
151 * Pittsburgh PA 15213-3890
152 *
153 * any improvements or extensions that they make and grant Carnegie Mellon
154 * the rights to redistribute these changes.
155 */
156 /*
157 */
158 /*
159 * Author: David B. Golub, Carnegie Mellon University
160 * Date: 7/90
161 */
162
163 #ifndef _DDB_DB_VARIABLES_H_
164 #define _DDB_DB_VARIABLES_H_
165
166 #include <kern/thread.h>
167 #include <machine/db_machdep.h> /* For db_expr_t */
168
169
170 #define DB_VAR_LEVEL 3 /* maximum number of suffix level */
171
172 /*
173 * auxiliary parameters passed to a variable handler
174 */
175 struct db_var_aux_param {
176 char *modif; /* option strings */
177 short level; /* number of levels */
178 short hidden_level; /* hidden level */
179 short suffix[DB_VAR_LEVEL]; /* suffix */
180 thread_t thr_act; /* target thr_act */
181 };
182
183 typedef struct db_var_aux_param *db_var_aux_param_t;
184
185
186 /*
187 * Debugger variables.
188 */
189 struct db_variable {
190 char *name; /* Name of variable */
191 db_expr_t *valuep; /* pointer to value of variable */
192 /* function to call when reading/writing */
193 int (*fcn)(struct db_variable *,db_expr_t *,int,db_var_aux_param_t);
194 short min_level; /* number of minimum suffix levels */
195 short max_level; /* number of maximum suffix levels */
196 short low; /* low value of level 1 suffix */
197 short high; /* high value of level 1 suffix */
198 boolean_t hidden_level; /* is there a hidden suffix level ? */
199 short hidden_low; /* low value of hidden level */
200 short hidden_high; /* high value of hidden level */
201 int *hidden_levelp; /* value of current hidden level */
202 boolean_t precious; /* print old value when affecting ? */
203 #define DB_VAR_GET 0
204 #define DB_VAR_SET 1
205 #define DB_VAR_SHOW 2
206 };
207
208 typedef struct db_variable *db_variable_t;
209
210 #define DB_VAR_NULL (db_variable_t)0
211
212 #define FCN_NULL ((int (*)(struct db_variable *, \
213 db_expr_t *, \
214 int, \
215 db_var_aux_param_t)) 0)
216
217 #define DB_VAR_LEVEL 3 /* maximum number of suffix level */
218 #define DB_MACRO_LEVEL 5 /* max macro nesting */
219 #define DB_MACRO_NARGS 10 /* max args per macro */
220
221 #define db_read_variable(vp, valuep) \
222 db_read_write_variable(vp, valuep, DB_VAR_GET, 0)
223 #define db_write_variable(vp, valuep) \
224 db_read_write_variable(vp, valuep, DB_VAR_SET, 0)
225
226
227 extern struct db_variable db_vars[]; /* debugger variables */
228 extern struct db_variable *db_evars;
229 extern struct db_variable db_regs[]; /* machine registers */
230 extern struct db_variable *db_eregs;
231
232 #if defined(ALTERNATE_REGISTER_DEFS)
233
234 extern struct db_variable db_altregs[]; /* alternate machine regs */
235 extern struct db_variable *db_ealtregs;
236
237 #endif /* defined(ALTERNATE_REGISTER_DEFS) */
238
239 /* Prototypes for functions exported by this module.
240 */
241
242 int db_get_variable(db_expr_t *valuep);
243
244 void db_read_write_variable(
245 struct db_variable *vp,
246 db_expr_t *valuep,
247 int rw_flag,
248 db_var_aux_param_t ap);
249
250 void db_set_cmd(void);
251
252 void db_show_one_variable(void);
253
254 void db_show_variable(void);
255
256 db_variable_t db_find_reg_name(char *s);
257
258 #endif /* !_DDB_DB_VARIABLES_H_ */