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