]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * $Source$ | |
3 | * $Header$ | |
4 | */ | |
5 | ||
6 | #ifndef lint | |
7 | static char *rcsid_gdb_debug_c = "$Header$"; | |
8 | #endif lint | |
9 | ||
10 | /************************************************************************/ | |
11 | /* | |
12 | /* gdb_debug.c | |
13 | /* | |
14 | /* Debugging interfaces for gdb. Some of these are | |
15 | /* designed to be called from dbx. | |
16 | /* | |
17 | /* routines included are: | |
18 | /* | |
19 | /* gdb_debug set the debugging status flags | |
20 | /* | |
21 | /* gd_types_print prints all the available types currently in | |
22 | /* the type table | |
23 | /* | |
24 | /* gd_con_status prints all the status codes for connections | |
25 | /* | |
26 | /* gd_sum_cons summarizes all current connections detailing | |
27 | /* for each flags, half connections with their | |
28 | /* respective operation queues. | |
29 | /* | |
30 | /* gd_op_q (halfcon) prints the queue associated with a | |
31 | /* specified half connection (not directly callable) | |
32 | /* | |
33 | /* gd_op_status a listing of the available states of an | |
34 | /* operation | |
35 | /* | |
36 | /* Copyright 1986 MIT Project Athena | |
37 | /* For copying and distribution information, please see | |
38 | /* the file <mit-copyright.h>. | |
39 | /* | |
40 | /************************************************************************/ | |
41 | ||
42 | #include <mit-copyright.h> | |
43 | #include <stdio.h> | |
44 | #include "gdb.h" | |
45 | ||
46 | /************************************************************************/ | |
47 | /* | |
48 | /* gdb_debug | |
49 | /* | |
50 | /* Toggle a debugging flag. Warning: the interface to this routine | |
51 | /* may change over time. | |
52 | /* | |
53 | /************************************************************************/ | |
54 | ||
55 | int | |
56 | gdb_debug(flag) | |
57 | { | |
58 | gdb_Debug ^= flag; /* toggle the flag */ | |
59 | } | |
60 | ||
61 | /************************************************************************/ | |
62 | /* | |
63 | /* print_relation | |
64 | /* | |
65 | /************************************************************************/ | |
66 | ||
67 | int | |
68 | print_relation(name, relation) | |
69 | char *name; | |
70 | RELATION relation; | |
71 | { | |
72 | FCN_PROPERTY(RELATION_T,FORMAT_PROPERTY)(name, (char *)&(relation)); | |
73 | } | |
74 | /************************************************************************/ | |
75 | /* | |
76 | /* print_tuple | |
77 | /* | |
78 | /************************************************************************/ | |
79 | ||
80 | int | |
81 | print_tuple(name, tuple) | |
82 | char *name; | |
83 | TUPLE tuple; | |
84 | { | |
85 | FCN_PROPERTY(TUPLE_T,FORMAT_PROPERTY)(name, (char *)&(tuple)); | |
86 | } | |
87 | ||
88 | /************************************************************************/ | |
89 | /* | |
90 | /* print_tuple_descriptor | |
91 | /* | |
92 | /************************************************************************/ | |
93 | ||
94 | int | |
95 | print_tuple_descriptor(name, tuple_descriptor) | |
96 | char *name; | |
97 | TUPLE_DESCRIPTOR tuple_descriptor; | |
98 | { | |
99 | FCN_PROPERTY(TUPLE_DESCRIPTOR_T,FORMAT_PROPERTY)(name, | |
100 | (char *)&(tuple_descriptor)); | |
101 | } | |
102 | ||
103 | /************************************************************************/ | |
104 | /* | |
105 | /* gd_types_print | |
106 | /* | |
107 | /* This is a routine for printing all the available types and | |
108 | /* their typecodes. | |
109 | /* | |
110 | /************************************************************************/ | |
111 | ||
112 | int | |
113 | gd_types_print () | |
114 | { | |
115 | register int i; | |
116 | ||
117 | printf ("\n\nTHE AVAILABLE TYPES WITH THEIR TYPE CODES ARE: \n\n"); | |
118 | ||
119 | printf ("typecode name\n"); | |
120 | ||
121 | for (i = 0; i < gdb_n_types; i++) { | |
122 | printf ("%2d %s \n", i, STR_PROPERTY(i,NAME_PROPERTY)); | |
123 | } | |
124 | } | |
125 | \f | |
126 | /************************************************************************/ | |
127 | /* | |
128 | /* con_status | |
129 | /* | |
130 | /* This routine will print all the status codes for operations | |
131 | /* This is just a listing of the status numbers located in gdb.h | |
132 | /* | |
133 | /************************************************************************/ | |
134 | ||
135 | int | |
136 | gd_con_status () | |
137 | { | |
138 | /*----------------------------------------------------------*/ | |
139 | /* | |
140 | /* REMEMBER... these need to be fixed when the connection | |
141 | /* status coded in gdb.h are redefined. | |
142 | /* | |
143 | /*----------------------------------------------------------*/ | |
144 | ||
145 | printf ("THE STATUS CODES ARE: \n\n"); | |
146 | printf (" CODE STATUS\n"); | |
147 | printf (" 1 CON_STOPPED\n"); | |
148 | printf (" 2 CON_UP\n"); | |
149 | printf (" 3 CON_STARTING\n"); | |
150 | printf (" 4 CON_STOPPING\n"); | |
151 | ||
152 | } | |
153 | ||
154 | \f | |
155 | /************************************************************************/ | |
156 | /* | |
157 | /* summarize connections (gd_sum_con) | |
158 | /* | |
159 | /************************************************************************/ | |
160 | ||
161 | gd_sum_con (index) | |
162 | int index; | |
163 | { | |
164 | if ((index > gdb_mcons) || (gdb_cons[index].status<1)) { | |
165 | printf ("gdb_cons[%d] is not a valid connection \n",index); | |
166 | return; | |
167 | } | |
168 | ||
169 | if (gdb_cons[index].status == CON_STOPPED) { | |
170 | printf ("connection gdb_cons[%d] is stopped\n",index); | |
171 | return; | |
172 | } | |
173 | ||
174 | /*----------------------------------------------------------*/ | |
175 | /* | |
176 | /* REMEMBER this also must be changed when the def'n | |
177 | /* of status fields in gdb.h is changed | |
178 | /* | |
179 | /*----------------------------------------------------------*/ | |
180 | ||
181 | ||
182 | printf ("status of connection number %d is %2d \n",index,gdb_cons[index].status); | |
183 | printf ("The information for each half-connexn: \n\n"); | |
184 | ||
185 | printf (" the inbound half-connection\n"); | |
186 | printf (" status: %2d \n",gdb_cons[index].in.status); | |
187 | printf (" flags : %2d \n",gdb_cons[index].in.status); | |
188 | printf (" file descr: %2d \n",gdb_cons[index].in.fd); | |
189 | printf (" The operation queue is:\n"); | |
190 | gd_op_q (&(gdb_cons[index].in)); | |
191 | ||
192 | printf (" the outbound half-connection\n"); | |
193 | printf (" status: %2d \n",gdb_cons[index].out.status); | |
194 | printf (" flags : %2d \n",gdb_cons[index].out.status); | |
195 | printf (" file descr: %2d \n",gdb_cons[index].out.fd); | |
196 | printf (" The operation queue is:\n"); | |
197 | gd_op_q (&(gdb_cons[index].out)); | |
198 | } | |
199 | ||
200 | \f | |
201 | /************************************************************************/ | |
202 | /* | |
203 | /* op_q (gd_op_q) | |
204 | /* | |
205 | /************************************************************************/ | |
206 | ||
207 | ||
208 | int | |
209 | gd_op_q (half_con) | |
210 | HALF_CONNECTION half_con; | |
211 | ||
212 | { | |
213 | int i; /*counter for the ith | |
214 | queued op */ | |
215 | OPERATION current; | |
216 | ||
217 | current = half_con->op_q_first; | |
218 | ||
219 | i = 0; | |
220 | ||
221 | if (current == NULL) { | |
222 | printf ("no operations in queue yet\n"); | |
223 | return ; | |
224 | } | |
225 | ||
226 | ||
227 | printf ("OPERATION STATUS\n\n"); | |
228 | ||
229 | while (current != (OPERATION)half_con) { | |
230 | printf ("%2d %2d \n", i++ , current->status); | |
231 | current = current ->next; | |
232 | } | |
233 | } | |
234 | \f | |
235 | /************************************************************************/ | |
236 | /* | |
237 | /* op status | |
238 | /* this is a routine in which all the status codes and their | |
239 | /* translations are printed. | |
240 | /* | |
241 | /************************************************************************/ | |
242 | ||
243 | int | |
244 | gd_op_status () | |
245 | { | |
246 | /*----------------------------------------------------------*/ | |
247 | /* | |
248 | /* REMEMBER these also need to be changed when | |
249 | /* states of an operation in gdb.h is redefined | |
250 | /* | |
251 | /*----------------------------------------------------------*/ | |
252 | ||
253 | printf ("CODE OPERATION STATE\n\n"); | |
254 | printf (" 1 OP_NOT_STARTED\n"); | |
255 | printf (" 2 OP_QUEUED\n"); | |
256 | printf (" 3 OP_RUNNING\n"); | |
257 | printf (" 4 OP_COMPLETE\n"); | |
258 | printf (" 5 OP_CANCELLING\n"); | |
259 | printf (" 6 OP_CANCELLED\n"); | |
260 | printf (" 7 OP_MARKED\n"); | |
261 | } |