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