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