]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_task_thread.h
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / ddb / db_task_thread.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:48 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.9.1 1994/09/23 01:22:09 ezf
38 * change marker to not FREE
39 * [1994/09/22 21:11:13 ezf]
40 *
41 * Revision 1.1.7.4 1994/03/17 22:35:38 dwm
42 * The infamous name change: thread_activation + thread_shuttle = thread.
43 * [1994/03/17 21:25:53 dwm]
44 *
45 * Revision 1.1.7.3 1994/02/03 21:44:27 bolinger
46 * Change a surviving current_thread() to current_act().
47 * [1994/02/03 20:48:03 bolinger]
48 *
49 * Revision 1.1.7.2 1994/01/12 17:50:56 dwm
50 * Coloc: initial restructuring to follow Utah model.
51 * [1994/01/12 17:13:27 dwm]
52 *
53 * Revision 1.1.7.1 1994/01/05 19:28:18 bolinger
54 * Separate notions of "address space" and "task" (i.e., symbol table),
55 * via new macros db_current_space() and db_is_current_space(); also update
56 * db_target_space() to treat kernel-loaded tasks correctly.
57 * [1994/01/04 17:41:47 bolinger]
58 *
59 * Revision 1.1.2.4 1993/07/27 18:28:17 elliston
60 * Add ANSI prototypes. CR #9523.
61 * [1993/07/27 18:13:10 elliston]
62 *
63 * Revision 1.1.2.3 1993/06/07 22:06:58 jeffc
64 * CR9176 - ANSI C violations: trailing tokens on CPP
65 * directives, extra semicolons after decl_ ..., asm keywords
66 * [1993/06/07 18:57:35 jeffc]
67 *
68 * Revision 1.1.2.2 1993/06/02 23:12:46 jeffc
69 * Added to OSF/1 R1.3 from NMK15.0.
70 * [1993/06/02 20:57:32 jeffc]
71 *
72 * Revision 1.1 1992/09/30 02:24:23 robert
73 * Initial revision
74 *
75 * $EndLog$
76 */
77 /* CMU_HIST */
78 /*
79 * Revision 2.2 91/10/09 16:03:18 af
80 * Revision 2.1.3.1 91/10/05 13:08:07 jeffreyh
81 * Created for task/thread handling.
82 * [91/08/29 tak]
83 *
84 * Revision 2.1.3.1 91/10/05 13:08:07 jeffreyh
85 * Created for task/thread handling.
86 * [91/08/29 tak]
87 *
88 */
89 /* CMU_ENDHIST */
90 /*
91 * Mach Operating System
92 * Copyright (c) 1991,1990 Carnegie Mellon University
93 * All Rights Reserved.
94 *
95 * Permission to use, copy, modify and distribute this software and its
96 * documentation is hereby granted, provided that both the copyright
97 * notice and this permission notice appear in all copies of the
98 * software, derivative works or modified versions, and any portions
99 * thereof, and that both notices appear in supporting documentation.
100 *
101 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
102 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
103 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
104 *
105 * Carnegie Mellon requests users of this software to return to
106 *
107 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
108 * School of Computer Science
109 * Carnegie Mellon University
110 * Pittsburgh PA 15213-3890
111 *
112 * any improvements or extensions that they make and grant Carnegie Mellon
113 * the rights to redistribute these changes.
114 */
115 /*
116 */
117
118 #ifndef _DDB_DB_TASK_THREAD_H_
119 #define _DDB_DB_TASK_THREAD_H_
120
121 #include <kern/task.h>
122 #include <kern/thread.h>
123 #include <kern/processor.h>
124 #include <ddb/db_variables.h> /* For db_var_aux_param_t */
125
126 /*
127 * On behalf of kernel-loaded tasks, distinguish between current task
128 * (=> symbol table) and current address space (=> where [e.g.]
129 * breakpoints are set). From ddb's perspective, kernel-loaded tasks
130 * can retain their own symbol tables, but share the kernel's address
131 * space.
132 */
133 #define db_current_task() \
134 ((current_act())? current_act()->task: TASK_NULL)
135 #define db_current_space() \
136 ((current_act() && !current_act()->kernel_loaded)?\
137 current_act()->task: TASK_NULL)
138 #define db_target_space(thr_act, user_space) \
139 ((!(user_space) || ((thr_act) && (thr_act)->kernel_loaded))?\
140 TASK_NULL: \
141 (thr_act)? \
142 (thr_act)->task: db_current_space())
143 #define db_is_current_space(task) \
144 ((task) == TASK_NULL || (task) == db_current_space())
145
146 extern task_t db_default_task; /* default target task */
147 extern thread_act_t db_default_act; /* default target thr_act */
148
149
150 /* Prototypes for functions exported by this module.
151 */
152
153 int db_lookup_act(thread_act_t target_act);
154
155 int db_lookup_task(task_t target_task);
156
157 int db_lookup_task_act(
158 task_t task,
159 thread_act_t target_act);
160
161 boolean_t db_check_act_address_valid(thread_act_t thr_act);
162
163 boolean_t db_get_next_act(
164 thread_act_t *actp,
165 int position);
166
167 void db_init_default_act(void);
168
169 int db_set_default_act(
170 struct db_variable *vp,
171 db_expr_t *valuep,
172 int flag,
173 db_var_aux_param_t ap);
174
175 int db_get_task_act(
176 struct db_variable *vp,
177 db_expr_t *valuep,
178 int flag,
179 db_var_aux_param_t ap);
180
181 #endif /* !_DDB_DB_TASK_THREAD_H_ */