]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_break.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / ddb / db_break.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:47 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.1.18.3 1995/01/06 19:10:05 devrcs
43 * mk6 CR668 - 1.3b26 merge
44 * 64bit cleanup, prototypes.
45 * [1994/10/14 03:39:52 dwm]
46 *
47 * Revision 1.1.18.2 1994/09/23 01:18:04 ezf
48 * change marker to not FREE
49 * [1994/09/22 21:09:24 ezf]
50 *
51 * Revision 1.1.18.1 1994/06/11 21:11:29 bolinger
52 * Merge up to NMK17.2.
53 * [1994/06/11 20:03:39 bolinger]
54 *
55 * Revision 1.1.16.1 1994/04/11 09:34:32 bernadat
56 * Moved db_breakpoint struct declaration from db_break.c
57 * to here.
58 * [94/03/16 bernadat]
59 *
60 * Revision 1.1.12.2 1994/03/17 22:35:24 dwm
61 * The infamous name change: thread_activation + thread_shuttle = thread.
62 * [1994/03/17 21:25:41 dwm]
63 *
64 * Revision 1.1.12.1 1994/01/12 17:50:30 dwm
65 * Coloc: initial restructuring to follow Utah model.
66 * [1994/01/12 17:13:00 dwm]
67 *
68 * Revision 1.1.4.4 1993/07/27 18:26:51 elliston
69 * Add ANSI prototypes. CR #9523.
70 * [1993/07/27 18:10:59 elliston]
71 *
72 * Revision 1.1.4.3 1993/06/07 22:06:31 jeffc
73 * CR9176 - ANSI C violations: trailing tokens on CPP
74 * directives, extra semicolons after decl_ ..., asm keywords
75 * [1993/06/07 18:57:06 jeffc]
76 *
77 * Revision 1.1.4.2 1993/06/02 23:10:21 jeffc
78 * Added to OSF/1 R1.3 from NMK15.0.
79 * [1993/06/02 20:55:49 jeffc]
80 *
81 * Revision 1.1 1992/09/30 02:24:12 robert
82 * Initial revision
83 *
84 * $EndLog$
85 */
86 /* CMU_HIST */
87 /*
88 * Revision 2.6 91/10/09 15:58:03 af
89 * Revision 2.5.3.1 91/10/05 13:05:04 jeffreyh
90 * Added db_thread_breakpoint structure, and added task and threads
91 * field to db_breakpoint structure. Some status flags were also
92 * added to keep track user space break point correctly.
93 * [91/08/29 tak]
94 *
95 * Revision 2.5.3.1 91/10/05 13:05:04 jeffreyh
96 * Added db_thread_breakpoint structure, and added task and threads
97 * field to db_breakpoint structure. Some status flags were also
98 * added to keep track user space break point correctly.
99 * [91/08/29 tak]
100 *
101 * Revision 2.5 91/05/14 15:32:35 mrt
102 * Correcting copyright
103 *
104 * Revision 2.4 91/02/05 17:06:06 mrt
105 * Changed to new Mach copyright
106 * [91/01/31 16:17:10 mrt]
107 *
108 * Revision 2.3 90/10/25 14:43:40 rwd
109 * Added map field to breakpoints.
110 * [90/10/18 rpd]
111 *
112 * Revision 2.2 90/08/27 21:50:00 dbg
113 * Modularized typedef names.
114 * [90/08/20 af]
115 * Add external defintions.
116 * [90/08/07 dbg]
117 * Created.
118 * [90/07/25 dbg]
119 *
120 */
121 /* CMU_ENDHIST */
122 /*
123 * Mach Operating System
124 * Copyright (c) 1991,1990 Carnegie Mellon University
125 * All Rights Reserved.
126 *
127 * Permission to use, copy, modify and distribute this software and its
128 * documentation is hereby granted, provided that both the copyright
129 * notice and this permission notice appear in all copies of the
130 * software, derivative works or modified versions, and any portions
131 * thereof, and that both notices appear in supporting documentation.
132 *
133 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
134 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
135 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
136 *
137 * Carnegie Mellon requests users of this software to return to
138 *
139 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
140 * School of Computer Science
141 * Carnegie Mellon University
142 * Pittsburgh PA 15213-3890
143 *
144 * any improvements or extensions that they make and grant Carnegie Mellon
145 * the rights to redistribute these changes.
146 */
147 /*
148 */
149 /*
150 * Author: David B. Golub, Carnegie Mellon University
151 * Date: 7/90
152 */
153 #ifndef _DDB_DB_BREAK_H_
154 #define _DDB_DB_BREAK_H_
155
156 #include <machine/db_machdep.h>
157 #include <kern/thread.h>
158 #include <kern/task.h>
159 #include <mach/boolean.h>
160
161 /*
162 * thread list at the same breakpoint address
163 */
164 struct db_thread_breakpoint {
165 vm_offset_t tb_task_thd; /* target task or thread */
166 boolean_t tb_is_task; /* task qualified */
167 short tb_number; /* breakpoint number */
168 short tb_init_count; /* skip count(initial value) */
169 short tb_count; /* current skip count */
170 short tb_cond; /* break condition */
171 struct db_thread_breakpoint *tb_next; /* next chain */
172 };
173 typedef struct db_thread_breakpoint *db_thread_breakpoint_t;
174
175 /*
176 * Breakpoint.
177 */
178 struct db_breakpoint {
179 task_t task; /* target task */
180 db_addr_t address; /* set here */
181 db_thread_breakpoint_t threads; /* thread */
182 int flags; /* flags: */
183 #define BKPT_SINGLE_STEP 0x2 /* to simulate single step */
184 #define BKPT_TEMP 0x4 /* temporary */
185 #define BKPT_USR_GLOBAL 0x8 /* global user space break point */
186 #define BKPT_SET_IN_MEM 0x10 /* break point is set in memory */
187 #define BKPT_1ST_SET 0x20 /* 1st time set of user global bkpt */
188 vm_size_t bkpt_inst; /* saved instruction at bkpt */
189 struct db_breakpoint *link; /* link in in-use or free chain */
190 };
191
192 typedef struct db_breakpoint *db_breakpoint_t;
193
194
195 /*
196 * Prototypes for functions exported by this module.
197 */
198
199 db_thread_breakpoint_t db_find_thread_breakpoint_here(
200 task_t task,
201 db_addr_t addr);
202
203 void db_check_breakpoint_valid(void);
204
205 void db_set_breakpoint(
206 task_t task,
207 db_addr_t addr,
208 int count,
209 thread_t thr_act,
210 boolean_t task_bpt);
211
212 db_breakpoint_t db_find_breakpoint(
213 task_t task,
214 db_addr_t addr);
215
216 boolean_t db_find_breakpoint_here(
217 task_t task,
218 db_addr_t addr);
219
220 db_thread_breakpoint_t db_find_breakpoint_number(
221 int num,
222 db_breakpoint_t *bkptp);
223
224 void db_set_breakpoints(void);
225
226 void db_clear_breakpoints(void);
227
228 db_breakpoint_t db_set_temp_breakpoint(
229 task_t task,
230 db_addr_t addr);
231
232 void db_delete_temp_breakpoint(
233 task_t task,
234 db_breakpoint_t bkpt);
235
236 void db_delete_cmd(void);
237
238 void db_breakpoint_cmd(
239 db_expr_t addr,
240 int have_addr,
241 db_expr_t count,
242 char * modif);
243
244 void db_listbreak_cmd(void);
245
246 #endif /* !_DDB_DB_BREAK_H_ */