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