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