Commit | Line | Data |
---|---|---|
c906108c SS |
1 | /* |
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 | * This file defines the internal interface to the core of CMA | |
18 | * debugging services. (The client interface to debugging services | |
19 | * is provided by cma_debug_client.h). | |
20 | */ | |
21 | ||
22 | #ifndef CMA_DEB_CORE | |
23 | #define CMA_DEB_CORE | |
24 | ||
25 | /* | |
26 | * INCLUDE FILES | |
27 | */ | |
28 | #include <cma.h> | |
29 | #include <cma_mutex.h> | |
30 | #include <cma_queue.h> | |
31 | #include <cma_tcb_defs.h> | |
32 | #include <cma_util.h> | |
33 | ||
34 | /* | |
35 | * CONSTANTS AND MACROS | |
36 | */ | |
37 | ||
38 | ||
39 | /* | |
40 | * TYPEDEFS | |
41 | */ | |
42 | ||
43 | /*FIX-ME* Need to use sizes that are platform specific */ | |
44 | typedef long int cma___t_debug_ctx[17]; | |
45 | ||
46 | /* | |
47 | * Type defing the format of known object lists | |
48 | */ | |
49 | typedef struct CMA__T_KNOWN_OBJECT { | |
50 | cma__t_queue queue; /* Queue header for known objects */ | |
51 | cma__t_int_mutex *mutex; /* Mutex to control access to queue */ | |
52 | } cma__t_known_object; | |
53 | ||
54 | ||
55 | /* | |
56 | * Type defining the registration for one debug client (e.g. Ada) | |
57 | */ | |
58 | typedef struct CMA__T_DEB_REGISTRY { | |
59 | cma_t_address entry; /* Client's debug entry point */ | |
60 | cma_t_key key; /* Client's context key */ | |
61 | cma_t_integer fac; /* Client's debug facility number */ | |
62 | cma_t_boolean has_prolog; /* Client's TCBs have std prolog */ | |
63 | } cma__t_deb_registry; | |
64 | ||
65 | #define cma__c_deb_max_clients 10 | |
66 | ||
67 | /* | |
68 | * Type defining the global debugging state for all threads. | |
69 | */ | |
70 | typedef struct CMA__T_DEBUG_STATE { | |
71 | /* | |
72 | * The following flag is set if changes were made while in the | |
73 | * debugger that may make the ready lists inconsistent. For | |
74 | * example, if a thread priority is changed in the debugger, the | |
75 | * thread is not moved between queues. Making things consistent | |
76 | * is deferred to when the dispatcher is next invoked -- which we | |
77 | * try to make very soon. | |
78 | */ | |
79 | cma_t_boolean is_inconsistency; /* Ready lists are inconsistent */ | |
80 | ||
81 | ||
82 | cma_t_boolean events_enabled; /* Set if _any_ event is enabled */ | |
83 | cma_t_boolean flags[cma__c_debevt__dim]; | |
84 | /* Which events are enabled */ | |
85 | cma__t_int_tcb *next_to_run; /* TCB of thread to run next */ | |
86 | ||
87 | cma__t_int_mutex *mutex; /* Mutex for registering clients */ | |
88 | cma_t_integer client_count; /* Count of debug clients */ | |
89 | cma__t_deb_registry clients[cma__c_deb_max_clients+1]; | |
9a2b4c1b MS |
90 | /* Array of current debug |
91 | clients */ | |
c906108c SS |
92 | } cma__t_debug_state; |
93 | ||
94 | ||
95 | /* | |
96 | * Routine that will symbolize and address and print it. | |
97 | */ | |
98 | typedef void (*cma__t_print_symbol) (cma_t_address); | |
99 | ||
100 | ||
101 | /* | |
102 | * GLOBAL DATA | |
103 | */ | |
104 | ||
105 | /* | |
106 | * Variable holding the global debugging state | |
107 | * | |
108 | * (This is primarily written by the debugger interface and read | |
109 | * by the thread dispatcher). | |
110 | */ | |
111 | extern cma__t_debug_state cma__g_debug_state; | |
112 | ||
113 | /* | |
114 | * Known object queues | |
115 | */ | |
116 | extern cma__t_known_object cma__g_known_atts; | |
117 | extern cma__t_known_object cma__g_known_cvs; | |
118 | extern cma__t_known_object cma__g_known_mutexes; | |
119 | extern cma__t_known_object cma__g_known_threads; | |
120 | ||
121 | /* | |
122 | * INTERNAL INTERFACES | |
123 | */ | |
124 | ||
125 | /* Get information while in debugger context */ | |
9a2b4c1b MS |
126 | extern void cma__deb_get (cma__t_int_tcb *, |
127 | cma_t_debug_get, | |
128 | cma_t_address, | |
129 | cma_t_integer,cma_t_integer); | |
c906108c SS |
130 | |
131 | /* Set information while in debugger context */ | |
9a2b4c1b MS |
132 | extern void cma__deb_set (cma__t_int_tcb *, cma_t_debug_set, |
133 | cma_t_address, cma_t_integer); | |
c906108c SS |
134 | |
135 | extern void cma__init_debug (void); | |
136 | ||
137 | extern void cma__reinit_debug (cma_t_integer); | |
138 | ||
9a2b4c1b | 139 | extern void cma__deb_anytcb_to_tcb (cma_t_tcb_header *, cma__t_int_tcb **); |
c906108c | 140 | |
9a2b4c1b | 141 | extern void cma__deb_fac_to_client (cma_t_integer, cma_t_key *); |
c906108c | 142 | |
9a2b4c1b MS |
143 | extern void cma__deb_get_client_info (cma_t_key, cma_t_address *, |
144 | cma_t_boolean *); | |
c906108c | 145 | |
9a2b4c1b | 146 | extern void cma__deb_get_context (cma__t_int_tcb *, cma_t_key,cma_t_address *); |
c906108c SS |
147 | |
148 | extern cma__t_int_tcb *cma__deb_get_self_tcb (void); | |
149 | ||
150 | extern void cma__deb_get_time_slice (cma_t_interval *); | |
151 | ||
9a2b4c1b MS |
152 | extern cma__t_int_tcb *cma__deb_next_tcb (cma__t_int_tcb *, |
153 | cma_t_integer *, | |
154 | cma_t_integer *, | |
155 | cma_t_boolean *); | |
c906108c SS |
156 | |
157 | extern cma_t_boolean cma__deb_set_alert (cma__t_int_tcb *); | |
158 | ||
159 | extern void cma__deb_set_next_thread (cma__t_int_tcb *); | |
160 | ||
161 | extern void cma__deb_set_force_dispatch (cma_t_address ); | |
162 | ||
163 | extern void cma__deb_set_time_slice (cma_t_interval); | |
164 | ||
9a2b4c1b MS |
165 | extern void cma__deb_show_thread (cma__t_int_tcb *, cma_t_boolean, |
166 | cma_t_boolean, cma___t_debug_ctx, | |
167 | cma__t_eol_routine, | |
168 | cma__t_eol_routine, cma__t_print_symbol); | |
c906108c SS |
169 | |
170 | extern void | |
9a2b4c1b MS |
171 | cma__deb_show_stats (cma__t_int_tcb *, cma_t_boolean, |
172 | cma_t_boolean, cma__t_eol_routine, | |
173 | cma__t_eol_routine, cma__t_print_symbol); | |
c906108c | 174 | #endif |