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