]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_variables.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
28 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
29 * Import of Mac OS X kernel (~semeria)
31 * Revision 1.1.1.1 1998/03/07 02:26:09 wsanchez
32 * Import of OSF Mach kernel (~mburg)
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]
38 * Merged '64-bit safe' changes from DEC alpha port.
39 * [1995/11/21 18:04:00 jfraser]
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]
45 * Revision 1.2.20.2 1994/10/14 03:47:19 dwm
46 * mk6 CR668 - 1.3b26 merge
48 * [1994/10/14 03:40:00 dwm]
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]
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]
58 * Revision 1.2.22.1 1994/12/06 19:43:29 alanl
59 * Intel merge, Oct 94 code drop.
61 * Add prototype for db_find_reg_name.
64 * Revision 1.2.15.1 1994/02/08 10:59:16 bernadat
65 * Added db_show_one_variable & db_show_variable prototypes
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.
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]
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]
82 * Revision 1.2 1993/04/19 16:03:36 devrcs
83 * New field used to display old register values with 'set' command
87 * Revision 1.1 1992/09/30 02:24:26 robert
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.
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.
105 * Revision 2.4 91/05/14 15:37:12 mrt
106 * Correcting copyright
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]
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.
124 * Mach Operating System
125 * Copyright (c) 1991,1990 Carnegie Mellon University
126 * All Rights Reserved.
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.
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.
138 * Carnegie Mellon requests users of this software to return to
140 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
141 * School of Computer Science
142 * Carnegie Mellon University
143 * Pittsburgh PA 15213-3890
145 * any improvements or extensions that they make and grant Carnegie Mellon
146 * the rights to redistribute these changes.
151 * Author: David B. Golub, Carnegie Mellon University
155 #ifndef _DDB_DB_VARIABLES_H_
156 #define _DDB_DB_VARIABLES_H_
158 #include <kern/thread.h>
159 #include <machine/db_machdep.h> /* For db_expr_t */
162 #define DB_VAR_LEVEL 3 /* maximum number of suffix level */
165 * auxiliary parameters passed to a variable handler
167 struct 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_t thr_act
; /* target thr_act */
175 typedef struct db_var_aux_param
*db_var_aux_param_t
;
179 * Debugger variables.
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 ? */
197 #define DB_VAR_SHOW 2
200 typedef struct db_variable
*db_variable_t
;
202 #define DB_VAR_NULL (db_variable_t)0
204 #define FCN_NULL ((int (*)(struct db_variable *, \
207 db_var_aux_param_t)) 0)
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 */
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)
219 extern struct db_variable db_vars
[]; /* debugger variables */
220 extern struct db_variable
*db_evars
;
221 extern struct db_variable db_regs
[]; /* machine registers */
222 extern struct db_variable
*db_eregs
;
224 #if defined(ALTERNATE_REGISTER_DEFS)
226 extern struct db_variable db_altregs
[]; /* alternate machine regs */
227 extern struct db_variable
*db_ealtregs
;
229 #endif /* defined(ALTERNATE_REGISTER_DEFS) */
231 /* Prototypes for functions exported by this module.
234 int db_get_variable(db_expr_t
*valuep
);
236 void db_read_write_variable(
237 struct db_variable
*vp
,
240 db_var_aux_param_t ap
);
242 void db_set_cmd(void);
244 void db_show_one_variable(void);
246 void db_show_variable(void);
248 db_variable_t
db_find_reg_name(char *s
);
250 #endif /* !_DDB_DB_VARIABLES_H_ */