1 /* Annotation routines for GDB.
2 Copyright (C) 1986-2013 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 3 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, see <http://www.gnu.org/licenses/>. */
24 #include "breakpoint.h"
28 /* Prototypes for local functions. */
30 extern void _initialize_annotate (void);
32 static void print_value_flags (struct type
*);
34 static void breakpoint_changed (struct breakpoint
*b
);
37 void (*deprecated_annotate_signalled_hook
) (void);
38 void (*deprecated_annotate_signal_hook
) (void);
41 print_value_flags (struct type
*t
)
43 if (can_dereference (t
))
44 printf_filtered (("*"));
46 printf_filtered (("-"));
50 annotate_breakpoints_changed (void)
52 if (annotation_level
== 2)
54 target_terminal_ours ();
55 printf_unfiltered (("\n\032\032breakpoints-invalid\n"));
60 annotate_breakpoint (int num
)
62 if (annotation_level
> 1)
63 printf_filtered (("\n\032\032breakpoint %d\n"), num
);
67 annotate_catchpoint (int num
)
69 if (annotation_level
> 1)
70 printf_filtered (("\n\032\032catchpoint %d\n"), num
);
74 annotate_watchpoint (int num
)
76 if (annotation_level
> 1)
77 printf_filtered (("\n\032\032watchpoint %d\n"), num
);
81 annotate_starting (void)
83 if (annotation_level
> 1)
84 printf_filtered (("\n\032\032starting\n"));
88 annotate_stopped (void)
90 if (annotation_level
> 1)
91 printf_filtered (("\n\032\032stopped\n"));
95 annotate_exited (int exitstatus
)
97 if (annotation_level
> 1)
98 printf_filtered (("\n\032\032exited %d\n"), exitstatus
);
102 annotate_signalled (void)
104 if (deprecated_annotate_signalled_hook
)
105 deprecated_annotate_signalled_hook ();
107 if (annotation_level
> 1)
108 printf_filtered (("\n\032\032signalled\n"));
112 annotate_signal_name (void)
114 if (annotation_level
== 2)
115 printf_filtered (("\n\032\032signal-name\n"));
119 annotate_signal_name_end (void)
121 if (annotation_level
== 2)
122 printf_filtered (("\n\032\032signal-name-end\n"));
126 annotate_signal_string (void)
128 if (annotation_level
== 2)
129 printf_filtered (("\n\032\032signal-string\n"));
133 annotate_signal_string_end (void)
135 if (annotation_level
== 2)
136 printf_filtered (("\n\032\032signal-string-end\n"));
140 annotate_signal (void)
142 if (deprecated_annotate_signal_hook
)
143 deprecated_annotate_signal_hook ();
145 if (annotation_level
> 1)
146 printf_filtered (("\n\032\032signal\n"));
150 annotate_breakpoints_headers (void)
152 if (annotation_level
== 2)
153 printf_filtered (("\n\032\032breakpoints-headers\n"));
157 annotate_field (int num
)
159 if (annotation_level
== 2)
160 printf_filtered (("\n\032\032field %d\n"), num
);
164 annotate_breakpoints_table (void)
166 if (annotation_level
== 2)
167 printf_filtered (("\n\032\032breakpoints-table\n"));
171 annotate_record (void)
173 if (annotation_level
== 2)
174 printf_filtered (("\n\032\032record\n"));
178 annotate_breakpoints_table_end (void)
180 if (annotation_level
== 2)
181 printf_filtered (("\n\032\032breakpoints-table-end\n"));
185 annotate_frames_invalid (void)
187 if (annotation_level
== 2)
189 target_terminal_ours ();
190 printf_unfiltered (("\n\032\032frames-invalid\n"));
195 annotate_new_thread (void)
197 if (annotation_level
> 1)
199 printf_unfiltered (("\n\032\032new-thread\n"));
204 annotate_thread_changed (void)
206 if (annotation_level
> 1)
208 printf_unfiltered (("\n\032\032thread-changed\n"));
213 annotate_field_begin (struct type
*type
)
215 if (annotation_level
== 2)
217 printf_filtered (("\n\032\032field-begin "));
218 print_value_flags (type
);
219 printf_filtered (("\n"));
224 annotate_field_name_end (void)
226 if (annotation_level
== 2)
227 printf_filtered (("\n\032\032field-name-end\n"));
231 annotate_field_value (void)
233 if (annotation_level
== 2)
234 printf_filtered (("\n\032\032field-value\n"));
238 annotate_field_end (void)
240 if (annotation_level
== 2)
241 printf_filtered (("\n\032\032field-end\n"));
247 if (annotation_level
> 1)
248 printf_filtered (("\n\032\032quit\n"));
252 annotate_error (void)
254 if (annotation_level
> 1)
255 printf_filtered (("\n\032\032error\n"));
259 annotate_error_begin (void)
261 if (annotation_level
> 1)
262 fprintf_filtered (gdb_stderr
, "\n\032\032error-begin\n");
266 annotate_value_history_begin (int histindex
, struct type
*type
)
268 if (annotation_level
== 2)
270 printf_filtered (("\n\032\032value-history-begin %d "), histindex
);
271 print_value_flags (type
);
272 printf_filtered (("\n"));
277 annotate_value_begin (struct type
*type
)
279 if (annotation_level
== 2)
281 printf_filtered (("\n\032\032value-begin "));
282 print_value_flags (type
);
283 printf_filtered (("\n"));
288 annotate_value_history_value (void)
290 if (annotation_level
== 2)
291 printf_filtered (("\n\032\032value-history-value\n"));
295 annotate_value_history_end (void)
297 if (annotation_level
== 2)
298 printf_filtered (("\n\032\032value-history-end\n"));
302 annotate_value_end (void)
304 if (annotation_level
== 2)
305 printf_filtered (("\n\032\032value-end\n"));
309 annotate_display_begin (void)
311 if (annotation_level
== 2)
312 printf_filtered (("\n\032\032display-begin\n"));
316 annotate_display_number_end (void)
318 if (annotation_level
== 2)
319 printf_filtered (("\n\032\032display-number-end\n"));
323 annotate_display_format (void)
325 if (annotation_level
== 2)
326 printf_filtered (("\n\032\032display-format\n"));
330 annotate_display_expression (void)
332 if (annotation_level
== 2)
333 printf_filtered (("\n\032\032display-expression\n"));
337 annotate_display_expression_end (void)
339 if (annotation_level
== 2)
340 printf_filtered (("\n\032\032display-expression-end\n"));
344 annotate_display_value (void)
346 if (annotation_level
== 2)
347 printf_filtered (("\n\032\032display-value\n"));
351 annotate_display_end (void)
353 if (annotation_level
== 2)
354 printf_filtered (("\n\032\032display-end\n"));
358 annotate_arg_begin (void)
360 if (annotation_level
== 2)
361 printf_filtered (("\n\032\032arg-begin\n"));
365 annotate_arg_name_end (void)
367 if (annotation_level
== 2)
368 printf_filtered (("\n\032\032arg-name-end\n"));
372 annotate_arg_value (struct type
*type
)
374 if (annotation_level
== 2)
376 printf_filtered (("\n\032\032arg-value "));
377 print_value_flags (type
);
378 printf_filtered (("\n"));
383 annotate_arg_end (void)
385 if (annotation_level
== 2)
386 printf_filtered (("\n\032\032arg-end\n"));
390 annotate_source (char *filename
, int line
, int character
, int mid
,
391 struct gdbarch
*gdbarch
, CORE_ADDR pc
)
393 if (annotation_level
> 1)
394 printf_filtered (("\n\032\032source "));
396 printf_filtered (("\032\032"));
398 printf_filtered (("%s:%d:%d:%s:%s\n"), filename
, line
, character
,
399 mid
? "middle" : "beg", paddress (gdbarch
, pc
));
403 annotate_frame_begin (int level
, struct gdbarch
*gdbarch
, CORE_ADDR pc
)
405 if (annotation_level
> 1)
406 printf_filtered (("\n\032\032frame-begin %d %s\n"),
407 level
, paddress (gdbarch
, pc
));
411 annotate_function_call (void)
413 if (annotation_level
== 2)
414 printf_filtered (("\n\032\032function-call\n"));
418 annotate_signal_handler_caller (void)
420 if (annotation_level
== 2)
421 printf_filtered (("\n\032\032signal-handler-caller\n"));
425 annotate_frame_address (void)
427 if (annotation_level
== 2)
428 printf_filtered (("\n\032\032frame-address\n"));
432 annotate_frame_address_end (void)
434 if (annotation_level
== 2)
435 printf_filtered (("\n\032\032frame-address-end\n"));
439 annotate_frame_function_name (void)
441 if (annotation_level
== 2)
442 printf_filtered (("\n\032\032frame-function-name\n"));
446 annotate_frame_args (void)
448 if (annotation_level
== 2)
449 printf_filtered (("\n\032\032frame-args\n"));
453 annotate_frame_source_begin (void)
455 if (annotation_level
== 2)
456 printf_filtered (("\n\032\032frame-source-begin\n"));
460 annotate_frame_source_file (void)
462 if (annotation_level
== 2)
463 printf_filtered (("\n\032\032frame-source-file\n"));
467 annotate_frame_source_file_end (void)
469 if (annotation_level
== 2)
470 printf_filtered (("\n\032\032frame-source-file-end\n"));
474 annotate_frame_source_line (void)
476 if (annotation_level
== 2)
477 printf_filtered (("\n\032\032frame-source-line\n"));
481 annotate_frame_source_end (void)
483 if (annotation_level
== 2)
484 printf_filtered (("\n\032\032frame-source-end\n"));
488 annotate_frame_where (void)
490 if (annotation_level
== 2)
491 printf_filtered (("\n\032\032frame-where\n"));
495 annotate_frame_end (void)
497 if (annotation_level
== 2)
498 printf_filtered (("\n\032\032frame-end\n"));
502 annotate_array_section_begin (int idx
, struct type
*elttype
)
504 if (annotation_level
== 2)
506 printf_filtered (("\n\032\032array-section-begin %d "), idx
);
507 print_value_flags (elttype
);
508 printf_filtered (("\n"));
513 annotate_elt_rep (unsigned int repcount
)
515 if (annotation_level
== 2)
516 printf_filtered (("\n\032\032elt-rep %u\n"), repcount
);
520 annotate_elt_rep_end (void)
522 if (annotation_level
== 2)
523 printf_filtered (("\n\032\032elt-rep-end\n"));
529 if (annotation_level
== 2)
530 printf_filtered (("\n\032\032elt\n"));
534 annotate_array_section_end (void)
536 if (annotation_level
== 2)
537 printf_filtered (("\n\032\032array-section-end\n"));
541 breakpoint_changed (struct breakpoint
*b
)
543 annotate_breakpoints_changed ();
547 _initialize_annotate (void)
549 if (annotation_level
== 2)
551 observer_attach_breakpoint_deleted (breakpoint_changed
);
552 observer_attach_breakpoint_modified (breakpoint_changed
);