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