* Fixing typo that caused infinite loop upon PKE MPG.
[binutils-gdb.git] / gdb / annotate.c
blob09d31f523539a770e4bb5b1431530bccb10176de
1 /* Annotation routines for GDB.
2 Copyright 1986, 1989, 1990, 1991, 1992, 1995 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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. */
20 #include "defs.h"
21 #include "annotate.h"
22 #include "value.h"
23 #include "target.h"
24 #include "gdbtypes.h"
25 #include "breakpoint.h"
27 static void print_value_flags PARAMS ((struct type *));
28 static void breakpoint_changed PARAMS ((struct breakpoint *));
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));
35 static void
36 print_value_flags (t)
37 struct type *t;
39 if (can_dereference (t))
40 printf_filtered ("*");
41 else
42 printf_filtered ("-");
45 void
46 breakpoints_changed ()
48 if (annotation_level > 1)
50 target_terminal_ours ();
51 printf_unfiltered ("\n\032\032breakpoints-invalid\n");
55 void
56 annotate_breakpoint (num)
57 int num;
59 if (annotation_level > 1)
60 printf_filtered ("\n\032\032breakpoint %d\n", num);
63 void
64 annotate_watchpoint (num)
65 int num;
67 if (annotation_level > 1)
68 printf_filtered ("\n\032\032watchpoint %d\n", num);
71 void
72 annotate_starting ()
75 if (annotate_starting_hook)
76 annotate_starting_hook ();
77 else
79 if (annotation_level > 1)
81 printf_filtered ("\n\032\032starting\n");
86 void
87 annotate_stopped ()
89 if (annotate_stopped_hook)
90 annotate_stopped_hook ();
91 else
93 if (annotation_level > 1)
94 printf_filtered ("\n\032\032stopped\n");
98 void
99 annotate_exited (exitstatus)
100 int exitstatus;
102 if (annotate_exited_hook)
103 annotate_exited_hook ();
104 else
106 if (annotation_level > 1)
107 printf_filtered ("\n\032\032exited %d\n", exitstatus);
111 void
112 annotate_signalled ()
114 if (annotate_signalled_hook)
115 annotate_signalled_hook ();
117 if (annotation_level > 1)
118 printf_filtered ("\n\032\032signalled\n");
121 void
122 annotate_signal_name ()
124 if (annotation_level > 1)
125 printf_filtered ("\n\032\032signal-name\n");
128 void
129 annotate_signal_name_end ()
131 if (annotation_level > 1)
132 printf_filtered ("\n\032\032signal-name-end\n");
135 void
136 annotate_signal_string ()
138 if (annotation_level > 1)
139 printf_filtered ("\n\032\032signal-string\n");
142 void
143 annotate_signal_string_end ()
145 if (annotation_level > 1)
146 printf_filtered ("\n\032\032signal-string-end\n");
149 void
150 annotate_signal ()
152 if (annotation_level > 1)
153 printf_filtered ("\n\032\032signal\n");
156 void
157 annotate_breakpoints_headers ()
159 if (annotation_level > 1)
160 printf_filtered ("\n\032\032breakpoints-headers\n");
163 void
164 annotate_field (num)
165 int num;
167 if (annotation_level > 1)
168 printf_filtered ("\n\032\032field %d\n", num);
171 void
172 annotate_breakpoints_table ()
174 if (annotation_level > 1)
175 printf_filtered ("\n\032\032breakpoints-table\n");
178 void
179 annotate_record ()
181 if (annotation_level > 1)
182 printf_filtered ("\n\032\032record\n");
185 void
186 annotate_breakpoints_table_end ()
188 if (annotation_level > 1)
189 printf_filtered ("\n\032\032breakpoints-table-end\n");
192 void
193 annotate_frames_invalid ()
195 if (annotation_level > 1)
197 target_terminal_ours ();
198 printf_unfiltered ("\n\032\032frames-invalid\n");
202 void
203 annotate_field_begin (type)
204 struct type *type;
206 if (annotation_level > 1)
208 printf_filtered ("\n\032\032field-begin ");
209 print_value_flags (type);
210 printf_filtered ("\n");
214 void
215 annotate_field_name_end ()
217 if (annotation_level > 1)
218 printf_filtered ("\n\032\032field-name-end\n");
221 void
222 annotate_field_value ()
224 if (annotation_level > 1)
225 printf_filtered ("\n\032\032field-value\n");
228 void
229 annotate_field_end ()
231 if (annotation_level > 1)
232 printf_filtered ("\n\032\032field-end\n");
235 void
236 annotate_quit ()
238 if (annotation_level > 1)
239 printf_filtered ("\n\032\032quit\n");
242 void
243 annotate_error ()
245 if (annotation_level > 1)
246 printf_filtered ("\n\032\032error\n");
249 void
250 annotate_error_begin ()
252 if (annotation_level > 1)
253 fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
256 void
257 annotate_value_history_begin (histindex, type)
258 int histindex;
259 struct type *type;
261 if (annotation_level > 1)
263 printf_filtered ("\n\032\032value-history-begin %d ", histindex);
264 print_value_flags (type);
265 printf_filtered ("\n");
269 void
270 annotate_value_begin (type)
271 struct type *type;
273 if (annotation_level > 1)
275 printf_filtered ("\n\032\032value-begin ");
276 print_value_flags (type);
277 printf_filtered ("\n");
281 void
282 annotate_value_history_value ()
284 if (annotation_level > 1)
285 printf_filtered ("\n\032\032value-history-value\n");
288 void
289 annotate_value_history_end ()
291 if (annotation_level > 1)
292 printf_filtered ("\n\032\032value-history-end\n");
295 void
296 annotate_value_end ()
298 if (annotation_level > 1)
299 printf_filtered ("\n\032\032value-end\n");
302 void
303 annotate_display_begin ()
305 if (annotation_level > 1)
306 printf_filtered ("\n\032\032display-begin\n");
309 void
310 annotate_display_number_end ()
312 if (annotation_level > 1)
313 printf_filtered ("\n\032\032display-number-end\n");
316 void
317 annotate_display_format ()
319 if (annotation_level > 1)
320 printf_filtered ("\n\032\032display-format\n");
323 void
324 annotate_display_expression ()
326 if (annotation_level > 1)
327 printf_filtered ("\n\032\032display-expression\n");
330 void
331 annotate_display_expression_end ()
333 if (annotation_level > 1)
334 printf_filtered ("\n\032\032display-expression-end\n");
337 void
338 annotate_display_value ()
340 if (annotation_level > 1)
341 printf_filtered ("\n\032\032display-value\n");
344 void
345 annotate_display_end ()
347 if (annotation_level > 1)
348 printf_filtered ("\n\032\032display-end\n");
351 void
352 annotate_arg_begin ()
354 if (annotation_level > 1)
355 printf_filtered ("\n\032\032arg-begin\n");
358 void
359 annotate_arg_name_end ()
361 if (annotation_level > 1)
362 printf_filtered ("\n\032\032arg-name-end\n");
365 void
366 annotate_arg_value (type)
367 struct type *type;
369 if (annotation_level > 1)
371 printf_filtered ("\n\032\032arg-value ");
372 print_value_flags (type);
373 printf_filtered ("\n");
377 void
378 annotate_arg_end ()
380 if (annotation_level > 1)
381 printf_filtered ("\n\032\032arg-end\n");
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;
392 if (annotation_level > 1)
393 printf_filtered ("\n\032\032source ");
394 else
395 printf_filtered ("\032\032");
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");
404 void
405 annotate_frame_begin (level, pc)
406 int level;
407 CORE_ADDR pc;
409 if (annotation_level > 1)
411 printf_filtered ("\n\032\032frame-begin %d 0x", level);
412 print_address_numeric (pc, 0, gdb_stdout);
413 printf_filtered ("\n");
417 void
418 annotate_function_call ()
420 if (annotation_level > 1)
421 printf_filtered ("\n\032\032function-call\n");
424 void
425 annotate_signal_handler_caller ()
427 if (annotation_level > 1)
428 printf_filtered ("\n\032\032signal-handler-caller\n");
431 void
432 annotate_frame_address ()
434 if (annotation_level > 1)
435 printf_filtered ("\n\032\032frame-address\n");
438 void
439 annotate_frame_address_end ()
441 if (annotation_level > 1)
442 printf_filtered ("\n\032\032frame-address-end\n");
445 void
446 annotate_frame_function_name ()
448 if (annotation_level > 1)
449 printf_filtered ("\n\032\032frame-function-name\n");
452 void
453 annotate_frame_args ()
455 if (annotation_level > 1)
456 printf_filtered ("\n\032\032frame-args\n");
459 void
460 annotate_frame_source_begin ()
462 if (annotation_level > 1)
463 printf_filtered ("\n\032\032frame-source-begin\n");
466 void
467 annotate_frame_source_file ()
469 if (annotation_level > 1)
470 printf_filtered ("\n\032\032frame-source-file\n");
473 void
474 annotate_frame_source_file_end ()
476 if (annotation_level > 1)
477 printf_filtered ("\n\032\032frame-source-file-end\n");
480 void
481 annotate_frame_source_line ()
483 if (annotation_level > 1)
484 printf_filtered ("\n\032\032frame-source-line\n");
487 void
488 annotate_frame_source_end ()
490 if (annotation_level > 1)
491 printf_filtered ("\n\032\032frame-source-end\n");
494 void
495 annotate_frame_where ()
497 if (annotation_level > 1)
498 printf_filtered ("\n\032\032frame-where\n");
501 void
502 annotate_frame_end ()
504 if (annotation_level > 1)
505 printf_filtered ("\n\032\032frame-end\n");
508 void
509 annotate_array_section_begin (index, elttype)
510 int index;
511 struct type *elttype;
513 if (annotation_level > 1)
515 printf_filtered ("\n\032\032array-section-begin %d ", index);
516 print_value_flags (elttype);
517 printf_filtered ("\n");
521 void
522 annotate_elt_rep (repcount)
523 unsigned int repcount;
525 if (annotation_level > 1)
526 printf_filtered ("\n\032\032elt-rep %u\n", repcount);
529 void
530 annotate_elt_rep_end ()
532 if (annotation_level > 1)
533 printf_filtered ("\n\032\032elt-rep-end\n");
536 void
537 annotate_elt ()
539 if (annotation_level > 1)
540 printf_filtered ("\n\032\032elt\n");
543 void
544 annotate_array_section_end ()
546 if (annotation_level > 1)
547 printf_filtered ("\n\032\032array-section-end\n");
550 static void
551 breakpoint_changed (b)
552 struct breakpoint *b;
554 breakpoints_changed ();
557 void
558 _initialize_annotate ()
560 if (annotation_level > 1)
562 delete_breakpoint_hook = breakpoint_changed;
563 modify_breakpoint_hook = breakpoint_changed;