1 /* Annotation routines for GDB.
2 Copyright 1986, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1998, 1999,
3 2000 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 2 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, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
27 #include "breakpoint.h"
30 /* Prototypes for local functions. */
32 extern void _initialize_annotate (void);
34 static void print_value_flags (struct type
*);
36 static void breakpoint_changed (struct breakpoint
*);
38 void (*annotate_starting_hook
) (void);
39 void (*annotate_stopped_hook
) (void);
40 void (*annotate_signalled_hook
) (void);
41 void (*annotate_signal_hook
) (void);
42 void (*annotate_exited_hook
) (void);
44 static int ignore_count_changed
= 0;
47 print_value_flags (struct type
*t
)
49 if (can_dereference (t
))
50 printf_filtered ("*");
52 printf_filtered ("-");
56 breakpoints_changed (void)
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 (int num
)
83 if (annotation_level
> 1)
84 printf_filtered ("\n\032\032breakpoint %d\n", num
);
88 annotate_catchpoint (int num
)
90 if (annotation_level
> 1)
91 printf_filtered ("\n\032\032catchpoint %d\n", num
);
95 annotate_watchpoint (int num
)
97 if (annotation_level
> 1)
98 printf_filtered ("\n\032\032watchpoint %d\n", num
);
102 annotate_starting (void)
105 if (annotate_starting_hook
)
106 annotate_starting_hook ();
109 if (annotation_level
> 1)
111 printf_filtered ("\n\032\032starting\n");
117 annotate_stopped (void)
119 if (annotate_stopped_hook
)
120 annotate_stopped_hook ();
123 if (annotation_level
> 1)
124 printf_filtered ("\n\032\032stopped\n");
126 if (annotation_level
> 1 && ignore_count_changed
)
128 ignore_count_changed
= 0;
129 breakpoints_changed ();
134 annotate_exited (int exitstatus
)
136 if (annotate_exited_hook
)
137 annotate_exited_hook ();
140 if (annotation_level
> 1)
141 printf_filtered ("\n\032\032exited %d\n", exitstatus
);
146 annotate_signalled (void)
148 if (annotate_signalled_hook
)
149 annotate_signalled_hook ();
151 if (annotation_level
> 1)
152 printf_filtered ("\n\032\032signalled\n");
156 annotate_signal_name (void)
158 if (annotation_level
> 1)
159 printf_filtered ("\n\032\032signal-name\n");
163 annotate_signal_name_end (void)
165 if (annotation_level
> 1)
166 printf_filtered ("\n\032\032signal-name-end\n");
170 annotate_signal_string (void)
172 if (annotation_level
> 1)
173 printf_filtered ("\n\032\032signal-string\n");
177 annotate_signal_string_end (void)
179 if (annotation_level
> 1)
180 printf_filtered ("\n\032\032signal-string-end\n");
184 annotate_signal (void)
186 if (annotate_signal_hook
)
187 annotate_signal_hook ();
189 if (annotation_level
> 1)
190 printf_filtered ("\n\032\032signal\n");
194 annotate_breakpoints_headers (void)
196 if (annotation_level
> 1)
197 printf_filtered ("\n\032\032breakpoints-headers\n");
201 annotate_field (int num
)
203 if (annotation_level
> 1)
204 printf_filtered ("\n\032\032field %d\n", num
);
208 annotate_breakpoints_table (void)
210 if (annotation_level
> 1)
211 printf_filtered ("\n\032\032breakpoints-table\n");
215 annotate_record (void)
217 if (annotation_level
> 1)
218 printf_filtered ("\n\032\032record\n");
222 annotate_breakpoints_table_end (void)
224 if (annotation_level
> 1)
225 printf_filtered ("\n\032\032breakpoints-table-end\n");
229 annotate_frames_invalid (void)
231 if (annotation_level
> 1)
233 target_terminal_ours ();
234 printf_unfiltered ("\n\032\032frames-invalid\n");
239 annotate_field_begin (struct type
*type
)
241 if (annotation_level
> 1)
243 printf_filtered ("\n\032\032field-begin ");
244 print_value_flags (type
);
245 printf_filtered ("\n");
250 annotate_field_name_end (void)
252 if (annotation_level
> 1)
253 printf_filtered ("\n\032\032field-name-end\n");
257 annotate_field_value (void)
259 if (annotation_level
> 1)
260 printf_filtered ("\n\032\032field-value\n");
264 annotate_field_end (void)
266 if (annotation_level
> 1)
267 printf_filtered ("\n\032\032field-end\n");
273 if (annotation_level
> 1)
274 printf_filtered ("\n\032\032quit\n");
278 annotate_error (void)
280 if (annotation_level
> 1)
281 printf_filtered ("\n\032\032error\n");
285 annotate_error_begin (void)
287 if (annotation_level
> 1)
288 fprintf_filtered (gdb_stderr
, "\n\032\032error-begin\n");
292 annotate_value_history_begin (int histindex
, struct type
*type
)
294 if (annotation_level
> 1)
296 printf_filtered ("\n\032\032value-history-begin %d ", histindex
);
297 print_value_flags (type
);
298 printf_filtered ("\n");
303 annotate_value_begin (struct type
*type
)
305 if (annotation_level
> 1)
307 printf_filtered ("\n\032\032value-begin ");
308 print_value_flags (type
);
309 printf_filtered ("\n");
314 annotate_value_history_value (void)
316 if (annotation_level
> 1)
317 printf_filtered ("\n\032\032value-history-value\n");
321 annotate_value_history_end (void)
323 if (annotation_level
> 1)
324 printf_filtered ("\n\032\032value-history-end\n");
328 annotate_value_end (void)
330 if (annotation_level
> 1)
331 printf_filtered ("\n\032\032value-end\n");
335 annotate_display_begin (void)
337 if (annotation_level
> 1)
338 printf_filtered ("\n\032\032display-begin\n");
342 annotate_display_number_end (void)
344 if (annotation_level
> 1)
345 printf_filtered ("\n\032\032display-number-end\n");
349 annotate_display_format (void)
351 if (annotation_level
> 1)
352 printf_filtered ("\n\032\032display-format\n");
356 annotate_display_expression (void)
358 if (annotation_level
> 1)
359 printf_filtered ("\n\032\032display-expression\n");
363 annotate_display_expression_end (void)
365 if (annotation_level
> 1)
366 printf_filtered ("\n\032\032display-expression-end\n");
370 annotate_display_value (void)
372 if (annotation_level
> 1)
373 printf_filtered ("\n\032\032display-value\n");
377 annotate_display_end (void)
379 if (annotation_level
> 1)
380 printf_filtered ("\n\032\032display-end\n");
384 annotate_arg_begin (void)
386 if (annotation_level
> 1)
387 printf_filtered ("\n\032\032arg-begin\n");
391 annotate_arg_name_end (void)
393 if (annotation_level
> 1)
394 printf_filtered ("\n\032\032arg-name-end\n");
398 annotate_arg_value (struct type
*type
)
400 if (annotation_level
> 1)
402 printf_filtered ("\n\032\032arg-value ");
403 print_value_flags (type
);
404 printf_filtered ("\n");
409 annotate_arg_end (void)
411 if (annotation_level
> 1)
412 printf_filtered ("\n\032\032arg-end\n");
416 annotate_source (char *filename
, int line
, int character
, int mid
, CORE_ADDR pc
)
418 if (annotation_level
> 1)
419 printf_filtered ("\n\032\032source ");
421 printf_filtered ("\032\032");
423 printf_filtered ("%s:%d:%d:%s:0x", filename
,
425 mid
? "middle" : "beg");
426 print_address_numeric (pc
, 0, gdb_stdout
);
427 printf_filtered ("\n");
431 annotate_frame_begin (int level
, CORE_ADDR pc
)
433 if (annotation_level
> 1)
435 printf_filtered ("\n\032\032frame-begin %d 0x", level
);
436 print_address_numeric (pc
, 0, gdb_stdout
);
437 printf_filtered ("\n");
442 annotate_function_call (void)
444 if (annotation_level
> 1)
445 printf_filtered ("\n\032\032function-call\n");
449 annotate_signal_handler_caller (void)
451 if (annotation_level
> 1)
452 printf_filtered ("\n\032\032signal-handler-caller\n");
456 annotate_frame_address (void)
458 if (annotation_level
> 1)
459 printf_filtered ("\n\032\032frame-address\n");
463 annotate_frame_address_end (void)
465 if (annotation_level
> 1)
466 printf_filtered ("\n\032\032frame-address-end\n");
470 annotate_frame_function_name (void)
472 if (annotation_level
> 1)
473 printf_filtered ("\n\032\032frame-function-name\n");
477 annotate_frame_args (void)
479 if (annotation_level
> 1)
480 printf_filtered ("\n\032\032frame-args\n");
484 annotate_frame_source_begin (void)
486 if (annotation_level
> 1)
487 printf_filtered ("\n\032\032frame-source-begin\n");
491 annotate_frame_source_file (void)
493 if (annotation_level
> 1)
494 printf_filtered ("\n\032\032frame-source-file\n");
498 annotate_frame_source_file_end (void)
500 if (annotation_level
> 1)
501 printf_filtered ("\n\032\032frame-source-file-end\n");
505 annotate_frame_source_line (void)
507 if (annotation_level
> 1)
508 printf_filtered ("\n\032\032frame-source-line\n");
512 annotate_frame_source_end (void)
514 if (annotation_level
> 1)
515 printf_filtered ("\n\032\032frame-source-end\n");
519 annotate_frame_where (void)
521 if (annotation_level
> 1)
522 printf_filtered ("\n\032\032frame-where\n");
526 annotate_frame_end (void)
528 if (annotation_level
> 1)
529 printf_filtered ("\n\032\032frame-end\n");
533 annotate_array_section_begin (int index
, struct type
*elttype
)
535 if (annotation_level
> 1)
537 printf_filtered ("\n\032\032array-section-begin %d ", index
);
538 print_value_flags (elttype
);
539 printf_filtered ("\n");
544 annotate_elt_rep (unsigned int repcount
)
546 if (annotation_level
> 1)
547 printf_filtered ("\n\032\032elt-rep %u\n", repcount
);
551 annotate_elt_rep_end (void)
553 if (annotation_level
> 1)
554 printf_filtered ("\n\032\032elt-rep-end\n");
560 if (annotation_level
> 1)
561 printf_filtered ("\n\032\032elt\n");
565 annotate_array_section_end (void)
567 if (annotation_level
> 1)
568 printf_filtered ("\n\032\032array-section-end\n");
572 breakpoint_changed (struct breakpoint
*b
)
574 breakpoints_changed ();
578 _initialize_annotate (void)
580 if (annotation_level
> 1)
582 delete_breakpoint_hook
= breakpoint_changed
;
583 modify_breakpoint_hook
= breakpoint_changed
;
This page took 0.04123 seconds and 4 git commands to generate.