Fri Sep 18 14:07:44 1998 Michael Snyder <msnyder@cleaver.cygnus.com>
[deliverable/binutils-gdb.git] / gdb / annotate.c
1 /* Annotation routines for GDB.
2 Copyright 1986, 1989, 1990, 1991, 1992, 1995 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20 #include "defs.h"
21 #include "annotate.h"
22 #include "value.h"
23 #include "target.h"
24 #include "gdbtypes.h"
25 #include "breakpoint.h"
26 \f
27 static void print_value_flags PARAMS ((struct type *));
28 static void breakpoint_changed PARAMS ((struct breakpoint *));
29
30 void (*annotate_starting_hook) PARAMS ((void));
31 void (*annotate_stopped_hook) PARAMS ((void));
32 void (*annotate_signalled_hook) PARAMS ((void));
33 void (*annotate_exited_hook) PARAMS ((void));
34
35 static void
36 print_value_flags (t)
37 struct type *t;
38 {
39 if (can_dereference (t))
40 printf_filtered ("*");
41 else
42 printf_filtered ("-");
43 }
44 \f
45 void
46 breakpoints_changed ()
47 {
48 if (annotation_level > 1)
49 {
50 target_terminal_ours ();
51 printf_unfiltered ("\n\032\032breakpoints-invalid\n");
52 }
53 }
54
55 void
56 annotate_breakpoint (num)
57 int num;
58 {
59 if (annotation_level > 1)
60 printf_filtered ("\n\032\032breakpoint %d\n", num);
61 }
62
63 void
64 annotate_watchpoint (num)
65 int num;
66 {
67 if (annotation_level > 1)
68 printf_filtered ("\n\032\032watchpoint %d\n", num);
69 }
70
71 void
72 annotate_starting ()
73 {
74
75 if (annotate_starting_hook)
76 annotate_starting_hook ();
77 else
78 {
79 if (annotation_level > 1)
80 {
81 printf_filtered ("\n\032\032starting\n");
82 }
83 }
84 }
85
86 void
87 annotate_stopped ()
88 {
89 if (annotate_stopped_hook)
90 annotate_stopped_hook ();
91 else
92 {
93 if (annotation_level > 1)
94 printf_filtered ("\n\032\032stopped\n");
95 }
96 }
97
98 void
99 annotate_exited (exitstatus)
100 int exitstatus;
101 {
102 if (annotate_exited_hook)
103 annotate_exited_hook ();
104 else
105 {
106 if (annotation_level > 1)
107 printf_filtered ("\n\032\032exited %d\n", exitstatus);
108 }
109 }
110
111 void
112 annotate_signalled ()
113 {
114 if (annotate_signalled_hook)
115 annotate_signalled_hook ();
116
117 if (annotation_level > 1)
118 printf_filtered ("\n\032\032signalled\n");
119 }
120
121 void
122 annotate_signal_name ()
123 {
124 if (annotation_level > 1)
125 printf_filtered ("\n\032\032signal-name\n");
126 }
127
128 void
129 annotate_signal_name_end ()
130 {
131 if (annotation_level > 1)
132 printf_filtered ("\n\032\032signal-name-end\n");
133 }
134
135 void
136 annotate_signal_string ()
137 {
138 if (annotation_level > 1)
139 printf_filtered ("\n\032\032signal-string\n");
140 }
141
142 void
143 annotate_signal_string_end ()
144 {
145 if (annotation_level > 1)
146 printf_filtered ("\n\032\032signal-string-end\n");
147 }
148
149 void
150 annotate_signal ()
151 {
152 if (annotation_level > 1)
153 printf_filtered ("\n\032\032signal\n");
154 }
155 \f
156 void
157 annotate_breakpoints_headers ()
158 {
159 if (annotation_level > 1)
160 printf_filtered ("\n\032\032breakpoints-headers\n");
161 }
162
163 void
164 annotate_field (num)
165 int num;
166 {
167 if (annotation_level > 1)
168 printf_filtered ("\n\032\032field %d\n", num);
169 }
170
171 void
172 annotate_breakpoints_table ()
173 {
174 if (annotation_level > 1)
175 printf_filtered ("\n\032\032breakpoints-table\n");
176 }
177
178 void
179 annotate_record ()
180 {
181 if (annotation_level > 1)
182 printf_filtered ("\n\032\032record\n");
183 }
184
185 void
186 annotate_breakpoints_table_end ()
187 {
188 if (annotation_level > 1)
189 printf_filtered ("\n\032\032breakpoints-table-end\n");
190 }
191
192 void
193 annotate_frames_invalid ()
194 {
195 if (annotation_level > 1)
196 {
197 target_terminal_ours ();
198 printf_unfiltered ("\n\032\032frames-invalid\n");
199 }
200 }
201
202 void
203 annotate_field_begin (type)
204 struct type *type;
205 {
206 if (annotation_level > 1)
207 {
208 printf_filtered ("\n\032\032field-begin ");
209 print_value_flags (type);
210 printf_filtered ("\n");
211 }
212 }
213
214 void
215 annotate_field_name_end ()
216 {
217 if (annotation_level > 1)
218 printf_filtered ("\n\032\032field-name-end\n");
219 }
220
221 void
222 annotate_field_value ()
223 {
224 if (annotation_level > 1)
225 printf_filtered ("\n\032\032field-value\n");
226 }
227
228 void
229 annotate_field_end ()
230 {
231 if (annotation_level > 1)
232 printf_filtered ("\n\032\032field-end\n");
233 }
234 \f
235 void
236 annotate_quit ()
237 {
238 if (annotation_level > 1)
239 printf_filtered ("\n\032\032quit\n");
240 }
241
242 void
243 annotate_error ()
244 {
245 if (annotation_level > 1)
246 printf_filtered ("\n\032\032error\n");
247 }
248
249 void
250 annotate_error_begin ()
251 {
252 if (annotation_level > 1)
253 fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
254 }
255
256 void
257 annotate_value_history_begin (histindex, type)
258 int histindex;
259 struct type *type;
260 {
261 if (annotation_level > 1)
262 {
263 printf_filtered ("\n\032\032value-history-begin %d ", histindex);
264 print_value_flags (type);
265 printf_filtered ("\n");
266 }
267 }
268
269 void
270 annotate_value_begin (type)
271 struct type *type;
272 {
273 if (annotation_level > 1)
274 {
275 printf_filtered ("\n\032\032value-begin ");
276 print_value_flags (type);
277 printf_filtered ("\n");
278 }
279 }
280
281 void
282 annotate_value_history_value ()
283 {
284 if (annotation_level > 1)
285 printf_filtered ("\n\032\032value-history-value\n");
286 }
287
288 void
289 annotate_value_history_end ()
290 {
291 if (annotation_level > 1)
292 printf_filtered ("\n\032\032value-history-end\n");
293 }
294
295 void
296 annotate_value_end ()
297 {
298 if (annotation_level > 1)
299 printf_filtered ("\n\032\032value-end\n");
300 }
301
302 void
303 annotate_display_begin ()
304 {
305 if (annotation_level > 1)
306 printf_filtered ("\n\032\032display-begin\n");
307 }
308
309 void
310 annotate_display_number_end ()
311 {
312 if (annotation_level > 1)
313 printf_filtered ("\n\032\032display-number-end\n");
314 }
315
316 void
317 annotate_display_format ()
318 {
319 if (annotation_level > 1)
320 printf_filtered ("\n\032\032display-format\n");
321 }
322
323 void
324 annotate_display_expression ()
325 {
326 if (annotation_level > 1)
327 printf_filtered ("\n\032\032display-expression\n");
328 }
329
330 void
331 annotate_display_expression_end ()
332 {
333 if (annotation_level > 1)
334 printf_filtered ("\n\032\032display-expression-end\n");
335 }
336
337 void
338 annotate_display_value ()
339 {
340 if (annotation_level > 1)
341 printf_filtered ("\n\032\032display-value\n");
342 }
343
344 void
345 annotate_display_end ()
346 {
347 if (annotation_level > 1)
348 printf_filtered ("\n\032\032display-end\n");
349 }
350
351 void
352 annotate_arg_begin ()
353 {
354 if (annotation_level > 1)
355 printf_filtered ("\n\032\032arg-begin\n");
356 }
357
358 void
359 annotate_arg_name_end ()
360 {
361 if (annotation_level > 1)
362 printf_filtered ("\n\032\032arg-name-end\n");
363 }
364
365 void
366 annotate_arg_value (type)
367 struct type *type;
368 {
369 if (annotation_level > 1)
370 {
371 printf_filtered ("\n\032\032arg-value ");
372 print_value_flags (type);
373 printf_filtered ("\n");
374 }
375 }
376
377 void
378 annotate_arg_end ()
379 {
380 if (annotation_level > 1)
381 printf_filtered ("\n\032\032arg-end\n");
382 }
383
384 void
385 annotate_source (filename, line, character, mid, pc)
386 char *filename;
387 int line;
388 int character;
389 int mid;
390 CORE_ADDR pc;
391 {
392 if (annotation_level > 1)
393 printf_filtered ("\n\032\032source ");
394 else
395 printf_filtered ("\032\032");
396
397 printf_filtered ("%s:%d:%d:%s:0x", filename,
398 line, character,
399 mid ? "middle" : "beg");
400 print_address_numeric (pc, 0, gdb_stdout);
401 printf_filtered ("\n");
402 }
403
404 void
405 annotate_frame_begin (level, pc)
406 int level;
407 CORE_ADDR pc;
408 {
409 if (annotation_level > 1)
410 {
411 printf_filtered ("\n\032\032frame-begin %d 0x", level);
412 print_address_numeric (pc, 0, gdb_stdout);
413 printf_filtered ("\n");
414 }
415 }
416
417 void
418 annotate_function_call ()
419 {
420 if (annotation_level > 1)
421 printf_filtered ("\n\032\032function-call\n");
422 }
423
424 void
425 annotate_signal_handler_caller ()
426 {
427 if (annotation_level > 1)
428 printf_filtered ("\n\032\032signal-handler-caller\n");
429 }
430
431 void
432 annotate_frame_address ()
433 {
434 if (annotation_level > 1)
435 printf_filtered ("\n\032\032frame-address\n");
436 }
437
438 void
439 annotate_frame_address_end ()
440 {
441 if (annotation_level > 1)
442 printf_filtered ("\n\032\032frame-address-end\n");
443 }
444
445 void
446 annotate_frame_function_name ()
447 {
448 if (annotation_level > 1)
449 printf_filtered ("\n\032\032frame-function-name\n");
450 }
451
452 void
453 annotate_frame_args ()
454 {
455 if (annotation_level > 1)
456 printf_filtered ("\n\032\032frame-args\n");
457 }
458
459 void
460 annotate_frame_source_begin ()
461 {
462 if (annotation_level > 1)
463 printf_filtered ("\n\032\032frame-source-begin\n");
464 }
465
466 void
467 annotate_frame_source_file ()
468 {
469 if (annotation_level > 1)
470 printf_filtered ("\n\032\032frame-source-file\n");
471 }
472
473 void
474 annotate_frame_source_file_end ()
475 {
476 if (annotation_level > 1)
477 printf_filtered ("\n\032\032frame-source-file-end\n");
478 }
479
480 void
481 annotate_frame_source_line ()
482 {
483 if (annotation_level > 1)
484 printf_filtered ("\n\032\032frame-source-line\n");
485 }
486
487 void
488 annotate_frame_source_end ()
489 {
490 if (annotation_level > 1)
491 printf_filtered ("\n\032\032frame-source-end\n");
492 }
493
494 void
495 annotate_frame_where ()
496 {
497 if (annotation_level > 1)
498 printf_filtered ("\n\032\032frame-where\n");
499 }
500
501 void
502 annotate_frame_end ()
503 {
504 if (annotation_level > 1)
505 printf_filtered ("\n\032\032frame-end\n");
506 }
507 \f
508 void
509 annotate_array_section_begin (index, elttype)
510 int index;
511 struct type *elttype;
512 {
513 if (annotation_level > 1)
514 {
515 printf_filtered ("\n\032\032array-section-begin %d ", index);
516 print_value_flags (elttype);
517 printf_filtered ("\n");
518 }
519 }
520
521 void
522 annotate_elt_rep (repcount)
523 unsigned int repcount;
524 {
525 if (annotation_level > 1)
526 printf_filtered ("\n\032\032elt-rep %u\n", repcount);
527 }
528
529 void
530 annotate_elt_rep_end ()
531 {
532 if (annotation_level > 1)
533 printf_filtered ("\n\032\032elt-rep-end\n");
534 }
535
536 void
537 annotate_elt ()
538 {
539 if (annotation_level > 1)
540 printf_filtered ("\n\032\032elt\n");
541 }
542
543 void
544 annotate_array_section_end ()
545 {
546 if (annotation_level > 1)
547 printf_filtered ("\n\032\032array-section-end\n");
548 }
549
550 static void
551 breakpoint_changed (b)
552 struct breakpoint *b;
553 {
554 breakpoints_changed ();
555 }
556
557 void
558 _initialize_annotate ()
559 {
560 if (annotation_level > 1)
561 {
562 delete_breakpoint_hook = breakpoint_changed;
563 modify_breakpoint_hook = breakpoint_changed;
564 }
565 }
This page took 0.040406 seconds and 4 git commands to generate.