1 /* Annotation routines for GDB.
2 Copyright (C) 1986, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1998, 1999,
3 2000, 2007, 2008, 2009 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 #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 (int);
38 void (*deprecated_annotate_signalled_hook) (void);
39 void (*deprecated_annotate_signal_hook) (void);
41 static int ignore_count_changed = 0;
44 print_value_flags (struct type *t)
46 if (can_dereference (t))
47 printf_filtered (("*"));
49 printf_filtered (("-"));
53 breakpoints_changed (void)
55 if (annotation_level == 2)
57 target_terminal_ours ();
58 printf_unfiltered (("\n\032\032breakpoints-invalid\n"));
59 if (ignore_count_changed)
60 ignore_count_changed = 0; /* Avoid multiple break annotations. */
64 /* The GUI needs to be informed of ignore_count changes, but we don't
65 want to provide successive multiple breakpoints-invalid messages
66 that are all caused by the fact that the ignore count is changing
67 (which could keep the GUI very busy). One is enough, after the
68 target actually "stops". */
71 annotate_ignore_count_change (void)
73 if (annotation_level > 1)
74 ignore_count_changed = 1;
78 annotate_breakpoint (int num)
80 if (annotation_level > 1)
81 printf_filtered (("\n\032\032breakpoint %d\n"), num);
85 annotate_catchpoint (int num)
87 if (annotation_level > 1)
88 printf_filtered (("\n\032\032catchpoint %d\n"), num);
92 annotate_watchpoint (int num)
94 if (annotation_level > 1)
95 printf_filtered (("\n\032\032watchpoint %d\n"), num);
99 annotate_starting (void)
101 if (annotation_level > 1)
102 printf_filtered (("\n\032\032starting\n"));
106 annotate_stopped (void)
108 if (annotation_level > 1)
109 printf_filtered (("\n\032\032stopped\n"));
110 if (annotation_level > 1 && ignore_count_changed)
112 ignore_count_changed = 0;
113 breakpoints_changed ();
118 annotate_exited (int exitstatus)
120 if (annotation_level > 1)
121 printf_filtered (("\n\032\032exited %d\n"), exitstatus);
125 annotate_signalled (void)
127 if (deprecated_annotate_signalled_hook)
128 deprecated_annotate_signalled_hook ();
130 if (annotation_level > 1)
131 printf_filtered (("\n\032\032signalled\n"));
135 annotate_signal_name (void)
137 if (annotation_level == 2)
138 printf_filtered (("\n\032\032signal-name\n"));
142 annotate_signal_name_end (void)
144 if (annotation_level == 2)
145 printf_filtered (("\n\032\032signal-name-end\n"));
149 annotate_signal_string (void)
151 if (annotation_level == 2)
152 printf_filtered (("\n\032\032signal-string\n"));
156 annotate_signal_string_end (void)
158 if (annotation_level == 2)
159 printf_filtered (("\n\032\032signal-string-end\n"));
163 annotate_signal (void)
165 if (deprecated_annotate_signal_hook)
166 deprecated_annotate_signal_hook ();
168 if (annotation_level > 1)
169 printf_filtered (("\n\032\032signal\n"));
173 annotate_breakpoints_headers (void)
175 if (annotation_level == 2)
176 printf_filtered (("\n\032\032breakpoints-headers\n"));
180 annotate_field (int num)
182 if (annotation_level == 2)
183 printf_filtered (("\n\032\032field %d\n"), num);
187 annotate_breakpoints_table (void)
189 if (annotation_level == 2)
190 printf_filtered (("\n\032\032breakpoints-table\n"));
194 annotate_record (void)
196 if (annotation_level == 2)
197 printf_filtered (("\n\032\032record\n"));
201 annotate_breakpoints_table_end (void)
203 if (annotation_level == 2)
204 printf_filtered (("\n\032\032breakpoints-table-end\n"));
208 annotate_frames_invalid (void)
210 if (annotation_level == 2)
212 target_terminal_ours ();
213 printf_unfiltered (("\n\032\032frames-invalid\n"));
218 annotate_new_thread (void)
220 if (annotation_level > 1)
222 printf_unfiltered (("\n\032\032new-thread\n"));
227 annotate_thread_changed (void)
229 if (annotation_level > 1)
231 printf_unfiltered (("\n\032\032thread-changed\n"));
236 annotate_field_begin (struct type *type)
238 if (annotation_level == 2)
240 printf_filtered (("\n\032\032field-begin "));
241 print_value_flags (type);
242 printf_filtered (("\n"));
247 annotate_field_name_end (void)
249 if (annotation_level == 2)
250 printf_filtered (("\n\032\032field-name-end\n"));
254 annotate_field_value (void)
256 if (annotation_level == 2)
257 printf_filtered (("\n\032\032field-value\n"));
261 annotate_field_end (void)
263 if (annotation_level == 2)
264 printf_filtered (("\n\032\032field-end\n"));
270 if (annotation_level > 1)
271 printf_filtered (("\n\032\032quit\n"));
275 annotate_error (void)
277 if (annotation_level > 1)
278 printf_filtered (("\n\032\032error\n"));
282 annotate_error_begin (void)
284 if (annotation_level > 1)
285 fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
289 annotate_value_history_begin (int histindex, struct type *type)
291 if (annotation_level == 2)
293 printf_filtered (("\n\032\032value-history-begin %d "), histindex);
294 print_value_flags (type);
295 printf_filtered (("\n"));
300 annotate_value_begin (struct type *type)
302 if (annotation_level == 2)
304 printf_filtered (("\n\032\032value-begin "));
305 print_value_flags (type);
306 printf_filtered (("\n"));
311 annotate_value_history_value (void)
313 if (annotation_level == 2)
314 printf_filtered (("\n\032\032value-history-value\n"));
318 annotate_value_history_end (void)
320 if (annotation_level == 2)
321 printf_filtered (("\n\032\032value-history-end\n"));
325 annotate_value_end (void)
327 if (annotation_level == 2)
328 printf_filtered (("\n\032\032value-end\n"));
332 annotate_display_begin (void)
334 if (annotation_level == 2)
335 printf_filtered (("\n\032\032display-begin\n"));
339 annotate_display_number_end (void)
341 if (annotation_level == 2)
342 printf_filtered (("\n\032\032display-number-end\n"));
346 annotate_display_format (void)
348 if (annotation_level == 2)
349 printf_filtered (("\n\032\032display-format\n"));
353 annotate_display_expression (void)
355 if (annotation_level == 2)
356 printf_filtered (("\n\032\032display-expression\n"));
360 annotate_display_expression_end (void)
362 if (annotation_level == 2)
363 printf_filtered (("\n\032\032display-expression-end\n"));
367 annotate_display_value (void)
369 if (annotation_level == 2)
370 printf_filtered (("\n\032\032display-value\n"));
374 annotate_display_end (void)
376 if (annotation_level == 2)
377 printf_filtered (("\n\032\032display-end\n"));
381 annotate_arg_begin (void)
383 if (annotation_level == 2)
384 printf_filtered (("\n\032\032arg-begin\n"));
388 annotate_arg_name_end (void)
390 if (annotation_level == 2)
391 printf_filtered (("\n\032\032arg-name-end\n"));
395 annotate_arg_value (struct type *type)
397 if (annotation_level == 2)
399 printf_filtered (("\n\032\032arg-value "));
400 print_value_flags (type);
401 printf_filtered (("\n"));
406 annotate_arg_end (void)
408 if (annotation_level == 2)
409 printf_filtered (("\n\032\032arg-end\n"));
413 annotate_source (char *filename, int line, int character, int mid, CORE_ADDR pc)
415 if (annotation_level > 1)
416 printf_filtered (("\n\032\032source "));
418 printf_filtered (("\032\032"));
420 printf_filtered (("%s:%d:%d:%s:%s\n"), filename, line, character,
421 mid ? "middle" : "beg", paddress (pc));
425 annotate_frame_begin (int level, CORE_ADDR pc)
427 if (annotation_level > 1)
428 printf_filtered (("\n\032\032frame-begin %d %s\n"), level, paddress (pc));
432 annotate_function_call (void)
434 if (annotation_level == 2)
435 printf_filtered (("\n\032\032function-call\n"));
439 annotate_signal_handler_caller (void)
441 if (annotation_level == 2)
442 printf_filtered (("\n\032\032signal-handler-caller\n"));
446 annotate_frame_address (void)
448 if (annotation_level == 2)
449 printf_filtered (("\n\032\032frame-address\n"));
453 annotate_frame_address_end (void)
455 if (annotation_level == 2)
456 printf_filtered (("\n\032\032frame-address-end\n"));
460 annotate_frame_function_name (void)
462 if (annotation_level == 2)
463 printf_filtered (("\n\032\032frame-function-name\n"));
467 annotate_frame_args (void)
469 if (annotation_level == 2)
470 printf_filtered (("\n\032\032frame-args\n"));
474 annotate_frame_source_begin (void)
476 if (annotation_level == 2)
477 printf_filtered (("\n\032\032frame-source-begin\n"));
481 annotate_frame_source_file (void)
483 if (annotation_level == 2)
484 printf_filtered (("\n\032\032frame-source-file\n"));
488 annotate_frame_source_file_end (void)
490 if (annotation_level == 2)
491 printf_filtered (("\n\032\032frame-source-file-end\n"));
495 annotate_frame_source_line (void)
497 if (annotation_level == 2)
498 printf_filtered (("\n\032\032frame-source-line\n"));
502 annotate_frame_source_end (void)
504 if (annotation_level == 2)
505 printf_filtered (("\n\032\032frame-source-end\n"));
509 annotate_frame_where (void)
511 if (annotation_level == 2)
512 printf_filtered (("\n\032\032frame-where\n"));
516 annotate_frame_end (void)
518 if (annotation_level == 2)
519 printf_filtered (("\n\032\032frame-end\n"));
523 annotate_array_section_begin (int index, struct type *elttype)
525 if (annotation_level == 2)
527 printf_filtered (("\n\032\032array-section-begin %d "), index);
528 print_value_flags (elttype);
529 printf_filtered (("\n"));
534 annotate_elt_rep (unsigned int repcount)
536 if (annotation_level == 2)
537 printf_filtered (("\n\032\032elt-rep %u\n"), repcount);
541 annotate_elt_rep_end (void)
543 if (annotation_level == 2)
544 printf_filtered (("\n\032\032elt-rep-end\n"));
550 if (annotation_level == 2)
551 printf_filtered (("\n\032\032elt\n"));
555 annotate_array_section_end (void)
557 if (annotation_level == 2)
558 printf_filtered (("\n\032\032array-section-end\n"));
562 breakpoint_changed (int bpno)
564 breakpoints_changed ();
568 _initialize_annotate (void)
570 if (annotation_level == 2)
572 observer_attach_breakpoint_deleted (breakpoint_changed);
573 observer_attach_breakpoint_modified (breakpoint_changed);