1 |
227 |
jeremybenn |
/*
|
2 |
|
|
* (c) Copyright 1990-1996 OPEN SOFTWARE FOUNDATION, INC.
|
3 |
|
|
* (c) Copyright 1990-1996 HEWLETT-PACKARD COMPANY
|
4 |
|
|
* (c) Copyright 1990-1996 DIGITAL EQUIPMENT CORPORATION
|
5 |
|
|
* (c) Copyright 1991, 1992 Siemens-Nixdorf Information Systems
|
6 |
|
|
* To anyone who acknowledges that this file is provided "AS IS" without
|
7 |
|
|
* any express or implied warranty: permission to use, copy, modify, and
|
8 |
|
|
* distribute this file for any purpose is hereby granted without fee,
|
9 |
|
|
* provided that the above copyright notices and this notice appears in
|
10 |
|
|
* all source code copies, and that none of the names listed above be used
|
11 |
|
|
* in advertising or publicity pertaining to distribution of the software
|
12 |
|
|
* without specific, written prior permission. None of these organizations
|
13 |
|
|
* makes any representations about the suitability of this software for
|
14 |
|
|
* any purpose.
|
15 |
|
|
*/
|
16 |
|
|
/*
|
17 |
|
|
* Header file providing access to CMA clients that implement
|
18 |
|
|
* language run-times to the CMA debugger capabilities.
|
19 |
|
|
*
|
20 |
|
|
* NOTE: the clients that are able to use this interface is
|
21 |
|
|
* very limited because clients needing task debugging must have
|
22 |
|
|
* support in the system debugger as well as here (at present).
|
23 |
|
|
* The following are the only legitimate clients of this interface:
|
24 |
|
|
* ADA runtime, C++ tasking library, and CMA.
|
25 |
|
|
*
|
26 |
|
|
*FIX-ME* We shall endeavor to extend these capabilities so that the
|
27 |
|
|
* all-platform CMA debugger CMA_DEBUG and any client can layer
|
28 |
|
|
* on thread debugging. But that is still an open design problem.
|
29 |
|
|
* The design here does not preclude that extension (for example,
|
30 |
|
|
* the identity of the debug-client is indicated in an "open"
|
31 |
|
|
* manner by using the CMA context key as the identifier.
|
32 |
|
|
*/
|
33 |
|
|
|
34 |
|
|
#ifndef CMA_DEBUG_CLIENT
|
35 |
|
|
#define CMA_DEBUG_CLIENT
|
36 |
|
|
|
37 |
|
|
/*
|
38 |
|
|
* INCLUDE FILES
|
39 |
|
|
*/
|
40 |
|
|
#include <cma.h>
|
41 |
|
|
|
42 |
|
|
/*
|
43 |
|
|
* CONSTANTS AND MACROS
|
44 |
|
|
*/
|
45 |
|
|
|
46 |
|
|
/*
|
47 |
|
|
* TYPEDEFS
|
48 |
|
|
*/
|
49 |
|
|
|
50 |
|
|
/*
|
51 |
|
|
* Type describing constants for a valid TCB sentinel.
|
52 |
|
|
* Exactly one value is valid, but we provide a symbolic name for
|
53 |
|
|
* at least one invalid sentinel as a convenience.
|
54 |
|
|
*/
|
55 |
|
|
typedef enum CMA_T_TCB_SENTINEL {
|
56 |
|
|
cma_c_tcb_sentinel_nogood = 0, /* Invalid sentinel constant */
|
57 |
|
|
cma_c_tcb_sentinel = 0x0ACEFACE /* Valid TCB sentinel */
|
58 |
|
|
} cma_t_tcb_sentinel;
|
59 |
|
|
|
60 |
|
|
/*
|
61 |
|
|
* Type describing pad fields needed to align the "standard prolog"
|
62 |
|
|
* to the right byte at the front of each TCB. These fields are
|
63 |
|
|
* free to be put to any use by the client.
|
64 |
|
|
*
|
65 |
|
|
* This is 32 bytes long and is fixed at this size for all clients
|
66 |
|
|
* and CMA, for all time.
|
67 |
|
|
*/
|
68 |
|
|
typedef struct CMA_T_TCB_PRIVATE {
|
69 |
|
|
cma_t_integer pad1;
|
70 |
|
|
cma_t_integer pad2;
|
71 |
|
|
cma_t_integer pad3;
|
72 |
|
|
cma_t_integer pad4;
|
73 |
|
|
cma_t_integer pad5;
|
74 |
|
|
cma_t_integer pad6;
|
75 |
|
|
cma_t_integer pad7;
|
76 |
|
|
cma_t_integer pad8;
|
77 |
|
|
} cma_t_tcb_private;
|
78 |
|
|
|
79 |
|
|
/*
|
80 |
|
|
* Type describing the "standard prolog" that clients should use
|
81 |
|
|
* within their task control blocks. We assume that the client will
|
82 |
|
|
* store their "task control block" as a per-thread context under
|
83 |
|
|
* the context key specified here.
|
84 |
|
|
*/
|
85 |
|
|
typedef struct CMA_T_TCB_PROLOG {
|
86 |
|
|
cma_t_tcb_sentinel sentinel; /* Validity sentinel */
|
87 |
|
|
cma_t_thread client_thread; /* Thread corresonding to task */
|
88 |
|
|
cma_t_key client_key; /* Context key this is stored under */
|
89 |
|
|
cma_t_address reserved1; /* Must be zero, reserved to CMA */
|
90 |
|
|
} cma_t_tcb_prolog;
|
91 |
|
|
|
92 |
|
|
/*
|
93 |
|
|
* Type defining the layout of all TCBs and TASKS. This format
|
94 |
|
|
* ensures that tasks will be self-identifying to the debugger.
|
95 |
|
|
* this layout must never change as the CMA DEBUG Clients cannot
|
96 |
|
|
* be changed after CMA ships.
|
97 |
|
|
*/
|
98 |
|
|
typedef struct CMA_T_TCB_HEADER {
|
99 |
|
|
cma_t_tcb_private IGNORED; /* TCB fields private to the client */
|
100 |
|
|
cma_t_tcb_prolog prolog; /* The standard prolog goes here */
|
101 |
|
|
} cma_t_tcb_header;
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
/*
|
105 |
|
|
* Type describing the kinds of information that a CMA debug
|
106 |
|
|
* client can GET about a thread.
|
107 |
|
|
*/
|
108 |
|
|
typedef enum CMA_T_DEBUG_GET {
|
109 |
|
|
/*
|
110 |
|
|
* All of the following items use a buffer whose size is
|
111 |
|
|
* four bytes. (That is four must be passed as the buffer_size
|
112 |
|
|
* parameter to cma_debug_get.)
|
113 |
|
|
*/
|
114 |
|
|
cma_c_debget_guardsize = 1, /* Current guard size (bytes) */
|
115 |
|
|
cma_c_debget_is_held = 2, /* Is it on hold? */
|
116 |
|
|
cma_c_debget_is_initial = 3, /* Is it the initial thread? */
|
117 |
|
|
cma_c_debget_number = 4, /* Thread's number */
|
118 |
|
|
cma_c_debget_stack_ptr = 5, /* Current stack pointer */
|
119 |
|
|
cma_c_debget_stack_base = 6, /* Stack base address */
|
120 |
|
|
cma_c_debget_stack_top = 7, /* Stack top address */
|
121 |
|
|
cma_c_debget_sched_state = 8, /* Scheduler state
|
122 |
|
|
* 0 - run
|
123 |
|
|
* 1 - ready
|
124 |
|
|
* 2 - blocked
|
125 |
|
|
* 3 - terminated
|
126 |
|
|
*/
|
127 |
|
|
cma_c_debget_reserve_size = 9, /* Size of stack reserve (bytes) */
|
128 |
|
|
cma_c_debget_base_prio = 10, /* Base priority */
|
129 |
|
|
cma_c_debget_priority = 11, /* Current priority */
|
130 |
|
|
cma_c_debget_regs = 12, /* Register set (and proc. state) */
|
131 |
|
|
cma_c_debget_alt_pending = 13, /* Alert is pending */
|
132 |
|
|
cma_c_debget_alt_a_enable = 14, /* Asynch alert delivery enabled */
|
133 |
|
|
cma_c_debget_alt_g_enable = 15, /* General alert delivery enabled */
|
134 |
|
|
cma_c_debget_substate = 16, /* Substate (or wait state) */
|
135 |
|
|
cma_c_debget_object_addr = 17, /* Address of thread object */
|
136 |
|
|
cma_c_debget_thkind = 18, /* Kind of thread */
|
137 |
|
|
cma_c_debget_detached = 19, /* Thread is detached */
|
138 |
|
|
cma_c_debget_tcb_size = 20, /* TCB size */
|
139 |
|
|
cma_c_debget_start_pc = 21, /* Start address */
|
140 |
|
|
cma_c_debget_next_pc = 22, /* Next instruction */
|
141 |
|
|
cma_c_debget_policy = 23, /* Sched policy */
|
142 |
|
|
cma_c_debget_stack_yellow = 24, /* Addr of start of guard area */
|
143 |
|
|
cma_c_debget_stack_default = 25 /* True if on default stack */
|
144 |
|
|
|
145 |
|
|
} cma_t_debug_get;
|
146 |
|
|
|
147 |
|
|
/*
|
148 |
|
|
* Type describing the kinds of information that a CMA debug
|
149 |
|
|
* client can SET (or change) about a thread using cma_debug_set.
|
150 |
|
|
*/
|
151 |
|
|
typedef enum CMA_T_DEBUG_SET {
|
152 |
|
|
/*
|
153 |
|
|
* All of the following items use a buffer whose size is
|
154 |
|
|
* four bytes. (That is four must be passed as the buffer_size
|
155 |
|
|
* parameter to cma_debug_set.)
|
156 |
|
|
*/
|
157 |
|
|
cma_c_debset_priority = 1, /* Set the priority */
|
158 |
|
|
cma_c_debset_policy = 2, /* Set the sched policy */
|
159 |
|
|
cma_c_debset_hold = 3, /* Put thread on hold */
|
160 |
|
|
cma_c_debset_regs = 4 /* Set the regs and proc. state */
|
161 |
|
|
|
162 |
|
|
} cma_t_debug_set;
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
/*
|
166 |
|
|
* GLOBAL DATA
|
167 |
|
|
*
|
168 |
|
|
* none
|
169 |
|
|
*/
|
170 |
|
|
|
171 |
|
|
/*
|
172 |
|
|
* EXTERNAL INTERFACES
|
173 |
|
|
*/
|
174 |
|
|
|
175 |
|
|
/*
|
176 |
|
|
* Routine to register with the CMA debug dispatcher.
|
177 |
|
|
*/
|
178 |
|
|
extern void cma_debug_register (cma_t_address,cma_t_key,cma_t_integer,cma_t_boolean);
|
179 |
|
|
|
180 |
|
|
/*
|
181 |
|
|
* Routine to get get thread state needed by the CMA debug client.
|
182 |
|
|
*/
|
183 |
|
|
extern void cma_debug_get (cma_t_thread *,cma_t_debug_get,cma_t_address,cma_t_integer);
|
184 |
|
|
|
185 |
|
|
/*
|
186 |
|
|
* Get thread context given an sp and a key
|
187 |
|
|
*/
|
188 |
|
|
extern void cma_debug_get_sp_context (cma_t_address,cma_t_key,cma_t_address *);
|
189 |
|
|
|
190 |
|
|
/*
|
191 |
|
|
* Routine to set thread state as needed by the CMA debug client.
|
192 |
|
|
*/
|
193 |
|
|
extern void cma_debug_set (cma_t_thread *,cma_t_debug_set,cma_t_address,cma_t_integer);
|
194 |
|
|
|
195 |
|
|
#endif
|