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