1 /* Annotation routines for GDB.
2 Copyright 1986, 89, 90, 91, 92, 95, 98, 1999 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,
19 Boston, MA 02111-1307, USA. */
26 #include "breakpoint.h"
29 /* Prototypes for local functions. */
31 extern void _initialize_annotate (void);
33 static void print_value_flags (struct type
*);
35 static void breakpoint_changed (struct breakpoint
*);
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);
43 static int ignore_count_changed
= 0;
49 if (can_dereference (t
))
50 printf_filtered ("*");
52 printf_filtered ("-");
56 breakpoints_changed ()
58 if (annotation_level
> 1)
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. */
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". */
74 annotate_ignore_count_change (void)
76 if (annotation_level
> 1)
77 ignore_count_changed
= 1;
81 annotate_breakpoint (num
)
84 if (annotation_level
> 1)
85 printf_filtered ("\n\032\032breakpoint %d\n", num
);
89 annotate_catchpoint (num
)
92 if (annotation_level
> 1)
93 printf_filtered ("\n\032\032catchpoint %d\n", num
);
97 annotate_watchpoint (num
)
100 if (annotation_level
> 1)
101 printf_filtered ("\n\032\032watchpoint %d\n", num
);
108 if (annotate_starting_hook
)
109 annotate_starting_hook ();
112 if (annotation_level
> 1)
114 printf_filtered ("\n\032\032starting\n");
122 if (annotate_stopped_hook
)
123 annotate_stopped_hook ();
126 if (annotation_level
> 1)
127 printf_filtered ("\n\032\032stopped\n");
129 if (annotation_level
> 1 && ignore_count_changed
)
131 ignore_count_changed
= 0;
132 breakpoints_changed ();
137 annotate_exited (exitstatus
)
140 if (annotate_exited_hook
)
141 annotate_exited_hook ();
144 if (annotation_level
> 1)
145 printf_filtered ("\n\032\032exited %d\n", exitstatus
);
150 annotate_signalled ()
152 if (annotate_signalled_hook
)
153 annotate_signalled_hook ();
155 if (annotation_level
> 1)
156 printf_filtered ("\n\032\032signalled\n");
160 annotate_signal_name ()
162 if (annotation_level
> 1)
163 printf_filtered ("\n\032\032signal-name\n");
167 annotate_signal_name_end ()
169 if (annotation_level
> 1)
170 printf_filtered ("\n\032\032signal-name-end\n");
174 annotate_signal_string ()
176 if (annotation_level
> 1)
177 printf_filtered ("\n\032\032signal-string\n");
181 annotate_signal_string_end ()
183 if (annotation_level
> 1)
184 printf_filtered ("\n\032\032signal-string-end\n");
190 if (annotate_signal_hook
)
191 annotate_signal_hook ();
193 if (annotation_level
> 1)
194 printf_filtered ("\n\032\032signal\n");
198 annotate_breakpoints_headers ()
200 if (annotation_level
> 1)
201 printf_filtered ("\n\032\032breakpoints-headers\n");
208 if (annotation_level
> 1)
209 printf_filtered ("\n\032\032field %d\n", num
);
213 annotate_breakpoints_table ()
215 if (annotation_level
> 1)
216 printf_filtered ("\n\032\032breakpoints-table\n");
222 if (annotation_level
> 1)
223 printf_filtered ("\n\032\032record\n");
227 annotate_breakpoints_table_end ()
229 if (annotation_level
> 1)
230 printf_filtered ("\n\032\032breakpoints-table-end\n");
234 annotate_frames_invalid ()
236 if (annotation_level
> 1)
238 target_terminal_ours ();
239 printf_unfiltered ("\n\032\032frames-invalid\n");
244 annotate_field_begin (type
)
247 if (annotation_level
> 1)
249 printf_filtered ("\n\032\032field-begin ");
250 print_value_flags (type
);
251 printf_filtered ("\n");
256 annotate_field_name_end ()
258 if (annotation_level
> 1)
259 printf_filtered ("\n\032\032field-name-end\n");
263 annotate_field_value ()
265 if (annotation_level
> 1)
266 printf_filtered ("\n\032\032field-value\n");
270 annotate_field_end ()
272 if (annotation_level
> 1)
273 printf_filtered ("\n\032\032field-end\n");
279 if (annotation_level
> 1)
280 printf_filtered ("\n\032\032quit\n");
286 if (annotation_level
> 1)
287 printf_filtered ("\n\032\032error\n");
291 annotate_error_begin ()
293 if (annotation_level
> 1)
294 fprintf_filtered (gdb_stderr
, "\n\032\032error-begin\n");
298 annotate_value_history_begin (histindex
, type
)
302 if (annotation_level
> 1)
304 printf_filtered ("\n\032\032value-history-begin %d ", histindex
);
305 print_value_flags (type
);
306 printf_filtered ("\n");
311 annotate_value_begin (type
)
314 if (annotation_level
> 1)
316 printf_filtered ("\n\032\032value-begin ");
317 print_value_flags (type
);
318 printf_filtered ("\n");
323 annotate_value_history_value ()
325 if (annotation_level
> 1)
326 printf_filtered ("\n\032\032value-history-value\n");
330 annotate_value_history_end ()
332 if (annotation_level
> 1)
333 printf_filtered ("\n\032\032value-history-end\n");
337 annotate_value_end ()
339 if (annotation_level
> 1)
340 printf_filtered ("\n\032\032value-end\n");
344 annotate_display_begin ()
346 if (annotation_level
> 1)
347 printf_filtered ("\n\032\032display-begin\n");
351 annotate_display_number_end ()
353 if (annotation_level
> 1)
354 printf_filtered ("\n\032\032display-number-end\n");
358 annotate_display_format ()
360 if (annotation_level
> 1)
361 printf_filtered ("\n\032\032display-format\n");
365 annotate_display_expression ()
367 if (annotation_level
> 1)
368 printf_filtered ("\n\032\032display-expression\n");
372 annotate_display_expression_end ()
374 if (annotation_level
> 1)
375 printf_filtered ("\n\032\032display-expression-end\n");
379 annotate_display_value ()
381 if (annotation_level
> 1)
382 printf_filtered ("\n\032\032display-value\n");
386 annotate_display_end ()
388 if (annotation_level
> 1)
389 printf_filtered ("\n\032\032display-end\n");
393 annotate_arg_begin ()
395 if (annotation_level
> 1)
396 printf_filtered ("\n\032\032arg-begin\n");
400 annotate_arg_name_end ()
402 if (annotation_level
> 1)
403 printf_filtered ("\n\032\032arg-name-end\n");
407 annotate_arg_value (type
)
410 if (annotation_level
> 1)
412 printf_filtered ("\n\032\032arg-value ");
413 print_value_flags (type
);
414 printf_filtered ("\n");
421 if (annotation_level
> 1)
422 printf_filtered ("\n\032\032arg-end\n");
426 annotate_source (filename
, line
, character
, mid
, pc
)
433 if (annotation_level
> 1)
434 printf_filtered ("\n\032\032source ");
436 printf_filtered ("\032\032");
438 printf_filtered ("%s:%d:%d:%s:0x", filename
,
440 mid
? "middle" : "beg");
441 print_address_numeric (pc
, 0, gdb_stdout
);
442 printf_filtered ("\n");
446 annotate_frame_begin (level
, pc
)
450 if (annotation_level
> 1)
452 printf_filtered ("\n\032\032frame-begin %d 0x", level
);
453 print_address_numeric (pc
, 0, gdb_stdout
);
454 printf_filtered ("\n");
459 annotate_function_call ()
461 if (annotation_level
> 1)
462 printf_filtered ("\n\032\032function-call\n");
466 annotate_signal_handler_caller ()
468 if (annotation_level
> 1)
469 printf_filtered ("\n\032\032signal-handler-caller\n");
473 annotate_frame_address ()
475 if (annotation_level
> 1)
476 printf_filtered ("\n\032\032frame-address\n");
480 annotate_frame_address_end ()
482 if (annotation_level
> 1)
483 printf_filtered ("\n\032\032frame-address-end\n");
487 annotate_frame_function_name ()
489 if (annotation_level
> 1)
490 printf_filtered ("\n\032\032frame-function-name\n");
494 annotate_frame_args ()
496 if (annotation_level
> 1)
497 printf_filtered ("\n\032\032frame-args\n");
501 annotate_frame_source_begin ()
503 if (annotation_level
> 1)
504 printf_filtered ("\n\032\032frame-source-begin\n");
508 annotate_frame_source_file ()
510 if (annotation_level
> 1)
511 printf_filtered ("\n\032\032frame-source-file\n");
515 annotate_frame_source_file_end ()
517 if (annotation_level
> 1)
518 printf_filtered ("\n\032\032frame-source-file-end\n");
522 annotate_frame_source_line ()
524 if (annotation_level
> 1)
525 printf_filtered ("\n\032\032frame-source-line\n");
529 annotate_frame_source_end ()
531 if (annotation_level
> 1)
532 printf_filtered ("\n\032\032frame-source-end\n");
536 annotate_frame_where ()
538 if (annotation_level
> 1)
539 printf_filtered ("\n\032\032frame-where\n");
543 annotate_frame_end ()
545 if (annotation_level
> 1)
546 printf_filtered ("\n\032\032frame-end\n");
550 annotate_array_section_begin (index
, elttype
)
552 struct type
*elttype
;
554 if (annotation_level
> 1)
556 printf_filtered ("\n\032\032array-section-begin %d ", index
);
557 print_value_flags (elttype
);
558 printf_filtered ("\n");
563 annotate_elt_rep (repcount
)
564 unsigned int repcount
;
566 if (annotation_level
> 1)
567 printf_filtered ("\n\032\032elt-rep %u\n", repcount
);
571 annotate_elt_rep_end ()
573 if (annotation_level
> 1)
574 printf_filtered ("\n\032\032elt-rep-end\n");
580 if (annotation_level
> 1)
581 printf_filtered ("\n\032\032elt\n");
585 annotate_array_section_end ()
587 if (annotation_level
> 1)
588 printf_filtered ("\n\032\032array-section-end\n");
592 breakpoint_changed (b
)
593 struct breakpoint
*b
;
595 breakpoints_changed ();
599 _initialize_annotate ()
601 if (annotation_level
> 1)
603 delete_breakpoint_hook
= breakpoint_changed
;
604 modify_breakpoint_hook
= breakpoint_changed
;