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