xref: /dflybsd-src/contrib/gdb-7/gdb/annotate.c (revision de8e141f24382815c10a4012d209bbbf7abf1112)
15796c8dcSSimon Schubert /* Annotation routines for GDB.
2*ef5ccd6cSJohn Marino    Copyright (C) 1986-2013 Free Software Foundation, Inc.
35796c8dcSSimon Schubert 
45796c8dcSSimon Schubert    This file is part of GDB.
55796c8dcSSimon Schubert 
65796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
75796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
85796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
95796c8dcSSimon Schubert    (at your option) any later version.
105796c8dcSSimon Schubert 
115796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
125796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
135796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
145796c8dcSSimon Schubert    GNU General Public License for more details.
155796c8dcSSimon Schubert 
165796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
175796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
185796c8dcSSimon Schubert 
195796c8dcSSimon Schubert #include "defs.h"
205796c8dcSSimon Schubert #include "annotate.h"
215796c8dcSSimon Schubert #include "value.h"
225796c8dcSSimon Schubert #include "target.h"
235796c8dcSSimon Schubert #include "gdbtypes.h"
245796c8dcSSimon Schubert #include "breakpoint.h"
255796c8dcSSimon Schubert #include "observer.h"
26*ef5ccd6cSJohn Marino #include "inferior.h"
275796c8dcSSimon Schubert 
285796c8dcSSimon Schubert 
295796c8dcSSimon Schubert /* Prototypes for local functions.  */
305796c8dcSSimon Schubert 
315796c8dcSSimon Schubert extern void _initialize_annotate (void);
325796c8dcSSimon Schubert 
335796c8dcSSimon Schubert static void print_value_flags (struct type *);
345796c8dcSSimon Schubert 
35a45ae5f8SJohn Marino static void breakpoint_changed (struct breakpoint *b);
365796c8dcSSimon Schubert 
375796c8dcSSimon Schubert 
385796c8dcSSimon Schubert void (*deprecated_annotate_signalled_hook) (void);
395796c8dcSSimon Schubert void (*deprecated_annotate_signal_hook) (void);
405796c8dcSSimon Schubert 
41*ef5ccd6cSJohn Marino /* Booleans indicating whether we've emitted certain notifications.
42*ef5ccd6cSJohn Marino    Used to suppress useless repeated notifications until the next time
43*ef5ccd6cSJohn Marino    we're ready to accept more commands.  Reset whenever a prompt is
44*ef5ccd6cSJohn Marino    displayed.  */
45*ef5ccd6cSJohn Marino static int frames_invalid_emitted;
46*ef5ccd6cSJohn Marino static int breakpoints_invalid_emitted;
47*ef5ccd6cSJohn Marino 
48*ef5ccd6cSJohn Marino /* True if the target can async, and a synchronous execution command
49*ef5ccd6cSJohn Marino    is not in progress.  If true, input is accepted, so don't suppress
50*ef5ccd6cSJohn Marino    annotations.  */
51*ef5ccd6cSJohn Marino 
52*ef5ccd6cSJohn Marino static int
async_background_execution_p(void)53*ef5ccd6cSJohn Marino async_background_execution_p (void)
54*ef5ccd6cSJohn Marino {
55*ef5ccd6cSJohn Marino   return (target_can_async_p () && !sync_execution);
56*ef5ccd6cSJohn Marino }
575796c8dcSSimon Schubert 
585796c8dcSSimon Schubert static void
print_value_flags(struct type * t)595796c8dcSSimon Schubert print_value_flags (struct type *t)
605796c8dcSSimon Schubert {
615796c8dcSSimon Schubert   if (can_dereference (t))
625796c8dcSSimon Schubert     printf_filtered (("*"));
635796c8dcSSimon Schubert   else
645796c8dcSSimon Schubert     printf_filtered (("-"));
655796c8dcSSimon Schubert }
66*ef5ccd6cSJohn Marino 
67*ef5ccd6cSJohn Marino static void
annotate_breakpoints_invalid(void)68*ef5ccd6cSJohn Marino annotate_breakpoints_invalid (void)
695796c8dcSSimon Schubert {
70*ef5ccd6cSJohn Marino   if (annotation_level == 2
71*ef5ccd6cSJohn Marino       && (!breakpoints_invalid_emitted
72*ef5ccd6cSJohn Marino 	  || async_background_execution_p ()))
735796c8dcSSimon Schubert     {
745796c8dcSSimon Schubert       target_terminal_ours ();
755796c8dcSSimon Schubert       printf_unfiltered (("\n\032\032breakpoints-invalid\n"));
76*ef5ccd6cSJohn Marino       breakpoints_invalid_emitted = 1;
775796c8dcSSimon Schubert     }
785796c8dcSSimon Schubert }
795796c8dcSSimon Schubert 
805796c8dcSSimon Schubert void
annotate_breakpoint(int num)815796c8dcSSimon Schubert annotate_breakpoint (int num)
825796c8dcSSimon Schubert {
835796c8dcSSimon Schubert   if (annotation_level > 1)
845796c8dcSSimon Schubert     printf_filtered (("\n\032\032breakpoint %d\n"), num);
855796c8dcSSimon Schubert }
865796c8dcSSimon Schubert 
875796c8dcSSimon Schubert void
annotate_catchpoint(int num)885796c8dcSSimon Schubert annotate_catchpoint (int num)
895796c8dcSSimon Schubert {
905796c8dcSSimon Schubert   if (annotation_level > 1)
915796c8dcSSimon Schubert     printf_filtered (("\n\032\032catchpoint %d\n"), num);
925796c8dcSSimon Schubert }
935796c8dcSSimon Schubert 
945796c8dcSSimon Schubert void
annotate_watchpoint(int num)955796c8dcSSimon Schubert annotate_watchpoint (int num)
965796c8dcSSimon Schubert {
975796c8dcSSimon Schubert   if (annotation_level > 1)
985796c8dcSSimon Schubert     printf_filtered (("\n\032\032watchpoint %d\n"), num);
995796c8dcSSimon Schubert }
1005796c8dcSSimon Schubert 
1015796c8dcSSimon Schubert void
annotate_starting(void)1025796c8dcSSimon Schubert annotate_starting (void)
1035796c8dcSSimon Schubert {
1045796c8dcSSimon Schubert   if (annotation_level > 1)
1055796c8dcSSimon Schubert     printf_filtered (("\n\032\032starting\n"));
1065796c8dcSSimon Schubert }
1075796c8dcSSimon Schubert 
1085796c8dcSSimon Schubert void
annotate_stopped(void)1095796c8dcSSimon Schubert annotate_stopped (void)
1105796c8dcSSimon Schubert {
1115796c8dcSSimon Schubert   if (annotation_level > 1)
1125796c8dcSSimon Schubert     printf_filtered (("\n\032\032stopped\n"));
1135796c8dcSSimon Schubert }
1145796c8dcSSimon Schubert 
1155796c8dcSSimon Schubert void
annotate_exited(int exitstatus)1165796c8dcSSimon Schubert annotate_exited (int exitstatus)
1175796c8dcSSimon Schubert {
1185796c8dcSSimon Schubert   if (annotation_level > 1)
1195796c8dcSSimon Schubert     printf_filtered (("\n\032\032exited %d\n"), exitstatus);
1205796c8dcSSimon Schubert }
1215796c8dcSSimon Schubert 
1225796c8dcSSimon Schubert void
annotate_signalled(void)1235796c8dcSSimon Schubert annotate_signalled (void)
1245796c8dcSSimon Schubert {
1255796c8dcSSimon Schubert   if (deprecated_annotate_signalled_hook)
1265796c8dcSSimon Schubert     deprecated_annotate_signalled_hook ();
1275796c8dcSSimon Schubert 
1285796c8dcSSimon Schubert   if (annotation_level > 1)
1295796c8dcSSimon Schubert     printf_filtered (("\n\032\032signalled\n"));
1305796c8dcSSimon Schubert }
1315796c8dcSSimon Schubert 
1325796c8dcSSimon Schubert void
annotate_signal_name(void)1335796c8dcSSimon Schubert annotate_signal_name (void)
1345796c8dcSSimon Schubert {
1355796c8dcSSimon Schubert   if (annotation_level == 2)
1365796c8dcSSimon Schubert     printf_filtered (("\n\032\032signal-name\n"));
1375796c8dcSSimon Schubert }
1385796c8dcSSimon Schubert 
1395796c8dcSSimon Schubert void
annotate_signal_name_end(void)1405796c8dcSSimon Schubert annotate_signal_name_end (void)
1415796c8dcSSimon Schubert {
1425796c8dcSSimon Schubert   if (annotation_level == 2)
1435796c8dcSSimon Schubert     printf_filtered (("\n\032\032signal-name-end\n"));
1445796c8dcSSimon Schubert }
1455796c8dcSSimon Schubert 
1465796c8dcSSimon Schubert void
annotate_signal_string(void)1475796c8dcSSimon Schubert annotate_signal_string (void)
1485796c8dcSSimon Schubert {
1495796c8dcSSimon Schubert   if (annotation_level == 2)
1505796c8dcSSimon Schubert     printf_filtered (("\n\032\032signal-string\n"));
1515796c8dcSSimon Schubert }
1525796c8dcSSimon Schubert 
1535796c8dcSSimon Schubert void
annotate_signal_string_end(void)1545796c8dcSSimon Schubert annotate_signal_string_end (void)
1555796c8dcSSimon Schubert {
1565796c8dcSSimon Schubert   if (annotation_level == 2)
1575796c8dcSSimon Schubert     printf_filtered (("\n\032\032signal-string-end\n"));
1585796c8dcSSimon Schubert }
1595796c8dcSSimon Schubert 
1605796c8dcSSimon Schubert void
annotate_signal(void)1615796c8dcSSimon Schubert annotate_signal (void)
1625796c8dcSSimon Schubert {
1635796c8dcSSimon Schubert   if (deprecated_annotate_signal_hook)
1645796c8dcSSimon Schubert     deprecated_annotate_signal_hook ();
1655796c8dcSSimon Schubert 
1665796c8dcSSimon Schubert   if (annotation_level > 1)
1675796c8dcSSimon Schubert     printf_filtered (("\n\032\032signal\n"));
1685796c8dcSSimon Schubert }
1695796c8dcSSimon Schubert 
1705796c8dcSSimon Schubert void
annotate_breakpoints_headers(void)1715796c8dcSSimon Schubert annotate_breakpoints_headers (void)
1725796c8dcSSimon Schubert {
1735796c8dcSSimon Schubert   if (annotation_level == 2)
1745796c8dcSSimon Schubert     printf_filtered (("\n\032\032breakpoints-headers\n"));
1755796c8dcSSimon Schubert }
1765796c8dcSSimon Schubert 
1775796c8dcSSimon Schubert void
annotate_field(int num)1785796c8dcSSimon Schubert annotate_field (int num)
1795796c8dcSSimon Schubert {
1805796c8dcSSimon Schubert   if (annotation_level == 2)
1815796c8dcSSimon Schubert     printf_filtered (("\n\032\032field %d\n"), num);
1825796c8dcSSimon Schubert }
1835796c8dcSSimon Schubert 
1845796c8dcSSimon Schubert void
annotate_breakpoints_table(void)1855796c8dcSSimon Schubert annotate_breakpoints_table (void)
1865796c8dcSSimon Schubert {
1875796c8dcSSimon Schubert   if (annotation_level == 2)
1885796c8dcSSimon Schubert     printf_filtered (("\n\032\032breakpoints-table\n"));
1895796c8dcSSimon Schubert }
1905796c8dcSSimon Schubert 
1915796c8dcSSimon Schubert void
annotate_record(void)1925796c8dcSSimon Schubert annotate_record (void)
1935796c8dcSSimon Schubert {
1945796c8dcSSimon Schubert   if (annotation_level == 2)
1955796c8dcSSimon Schubert     printf_filtered (("\n\032\032record\n"));
1965796c8dcSSimon Schubert }
1975796c8dcSSimon Schubert 
1985796c8dcSSimon Schubert void
annotate_breakpoints_table_end(void)1995796c8dcSSimon Schubert annotate_breakpoints_table_end (void)
2005796c8dcSSimon Schubert {
2015796c8dcSSimon Schubert   if (annotation_level == 2)
2025796c8dcSSimon Schubert     printf_filtered (("\n\032\032breakpoints-table-end\n"));
2035796c8dcSSimon Schubert }
2045796c8dcSSimon Schubert 
2055796c8dcSSimon Schubert void
annotate_frames_invalid(void)2065796c8dcSSimon Schubert annotate_frames_invalid (void)
2075796c8dcSSimon Schubert {
208*ef5ccd6cSJohn Marino   if (annotation_level == 2
209*ef5ccd6cSJohn Marino       && (!frames_invalid_emitted
210*ef5ccd6cSJohn Marino 	  || async_background_execution_p ()))
2115796c8dcSSimon Schubert     {
2125796c8dcSSimon Schubert       target_terminal_ours ();
2135796c8dcSSimon Schubert       printf_unfiltered (("\n\032\032frames-invalid\n"));
214*ef5ccd6cSJohn Marino       frames_invalid_emitted = 1;
2155796c8dcSSimon Schubert     }
2165796c8dcSSimon Schubert }
2175796c8dcSSimon Schubert 
2185796c8dcSSimon Schubert void
annotate_new_thread(void)2195796c8dcSSimon Schubert annotate_new_thread (void)
2205796c8dcSSimon Schubert {
2215796c8dcSSimon Schubert   if (annotation_level > 1)
2225796c8dcSSimon Schubert     {
2235796c8dcSSimon Schubert       printf_unfiltered (("\n\032\032new-thread\n"));
2245796c8dcSSimon Schubert     }
2255796c8dcSSimon Schubert }
2265796c8dcSSimon Schubert 
2275796c8dcSSimon Schubert void
annotate_thread_changed(void)2285796c8dcSSimon Schubert annotate_thread_changed (void)
2295796c8dcSSimon Schubert {
2305796c8dcSSimon Schubert   if (annotation_level > 1)
2315796c8dcSSimon Schubert     {
2325796c8dcSSimon Schubert       printf_unfiltered (("\n\032\032thread-changed\n"));
2335796c8dcSSimon Schubert     }
2345796c8dcSSimon Schubert }
2355796c8dcSSimon Schubert 
2365796c8dcSSimon Schubert void
annotate_field_begin(struct type * type)2375796c8dcSSimon Schubert annotate_field_begin (struct type *type)
2385796c8dcSSimon Schubert {
2395796c8dcSSimon Schubert   if (annotation_level == 2)
2405796c8dcSSimon Schubert     {
2415796c8dcSSimon Schubert       printf_filtered (("\n\032\032field-begin "));
2425796c8dcSSimon Schubert       print_value_flags (type);
2435796c8dcSSimon Schubert       printf_filtered (("\n"));
2445796c8dcSSimon Schubert     }
2455796c8dcSSimon Schubert }
2465796c8dcSSimon Schubert 
2475796c8dcSSimon Schubert void
annotate_field_name_end(void)2485796c8dcSSimon Schubert annotate_field_name_end (void)
2495796c8dcSSimon Schubert {
2505796c8dcSSimon Schubert   if (annotation_level == 2)
2515796c8dcSSimon Schubert     printf_filtered (("\n\032\032field-name-end\n"));
2525796c8dcSSimon Schubert }
2535796c8dcSSimon Schubert 
2545796c8dcSSimon Schubert void
annotate_field_value(void)2555796c8dcSSimon Schubert annotate_field_value (void)
2565796c8dcSSimon Schubert {
2575796c8dcSSimon Schubert   if (annotation_level == 2)
2585796c8dcSSimon Schubert     printf_filtered (("\n\032\032field-value\n"));
2595796c8dcSSimon Schubert }
2605796c8dcSSimon Schubert 
2615796c8dcSSimon Schubert void
annotate_field_end(void)2625796c8dcSSimon Schubert annotate_field_end (void)
2635796c8dcSSimon Schubert {
2645796c8dcSSimon Schubert   if (annotation_level == 2)
2655796c8dcSSimon Schubert     printf_filtered (("\n\032\032field-end\n"));
2665796c8dcSSimon Schubert }
2675796c8dcSSimon Schubert 
2685796c8dcSSimon Schubert void
annotate_quit(void)2695796c8dcSSimon Schubert annotate_quit (void)
2705796c8dcSSimon Schubert {
2715796c8dcSSimon Schubert   if (annotation_level > 1)
2725796c8dcSSimon Schubert     printf_filtered (("\n\032\032quit\n"));
2735796c8dcSSimon Schubert }
2745796c8dcSSimon Schubert 
2755796c8dcSSimon Schubert void
annotate_error(void)2765796c8dcSSimon Schubert annotate_error (void)
2775796c8dcSSimon Schubert {
2785796c8dcSSimon Schubert   if (annotation_level > 1)
2795796c8dcSSimon Schubert     printf_filtered (("\n\032\032error\n"));
2805796c8dcSSimon Schubert }
2815796c8dcSSimon Schubert 
2825796c8dcSSimon Schubert void
annotate_error_begin(void)2835796c8dcSSimon Schubert annotate_error_begin (void)
2845796c8dcSSimon Schubert {
2855796c8dcSSimon Schubert   if (annotation_level > 1)
2865796c8dcSSimon Schubert     fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
2875796c8dcSSimon Schubert }
2885796c8dcSSimon Schubert 
2895796c8dcSSimon Schubert void
annotate_value_history_begin(int histindex,struct type * type)2905796c8dcSSimon Schubert annotate_value_history_begin (int histindex, struct type *type)
2915796c8dcSSimon Schubert {
2925796c8dcSSimon Schubert   if (annotation_level == 2)
2935796c8dcSSimon Schubert     {
2945796c8dcSSimon Schubert       printf_filtered (("\n\032\032value-history-begin %d "), histindex);
2955796c8dcSSimon Schubert       print_value_flags (type);
2965796c8dcSSimon Schubert       printf_filtered (("\n"));
2975796c8dcSSimon Schubert     }
2985796c8dcSSimon Schubert }
2995796c8dcSSimon Schubert 
3005796c8dcSSimon Schubert void
annotate_value_begin(struct type * type)3015796c8dcSSimon Schubert annotate_value_begin (struct type *type)
3025796c8dcSSimon Schubert {
3035796c8dcSSimon Schubert   if (annotation_level == 2)
3045796c8dcSSimon Schubert     {
3055796c8dcSSimon Schubert       printf_filtered (("\n\032\032value-begin "));
3065796c8dcSSimon Schubert       print_value_flags (type);
3075796c8dcSSimon Schubert       printf_filtered (("\n"));
3085796c8dcSSimon Schubert     }
3095796c8dcSSimon Schubert }
3105796c8dcSSimon Schubert 
3115796c8dcSSimon Schubert void
annotate_value_history_value(void)3125796c8dcSSimon Schubert annotate_value_history_value (void)
3135796c8dcSSimon Schubert {
3145796c8dcSSimon Schubert   if (annotation_level == 2)
3155796c8dcSSimon Schubert     printf_filtered (("\n\032\032value-history-value\n"));
3165796c8dcSSimon Schubert }
3175796c8dcSSimon Schubert 
3185796c8dcSSimon Schubert void
annotate_value_history_end(void)3195796c8dcSSimon Schubert annotate_value_history_end (void)
3205796c8dcSSimon Schubert {
3215796c8dcSSimon Schubert   if (annotation_level == 2)
3225796c8dcSSimon Schubert     printf_filtered (("\n\032\032value-history-end\n"));
3235796c8dcSSimon Schubert }
3245796c8dcSSimon Schubert 
3255796c8dcSSimon Schubert void
annotate_value_end(void)3265796c8dcSSimon Schubert annotate_value_end (void)
3275796c8dcSSimon Schubert {
3285796c8dcSSimon Schubert   if (annotation_level == 2)
3295796c8dcSSimon Schubert     printf_filtered (("\n\032\032value-end\n"));
3305796c8dcSSimon Schubert }
3315796c8dcSSimon Schubert 
3325796c8dcSSimon Schubert void
annotate_display_begin(void)3335796c8dcSSimon Schubert annotate_display_begin (void)
3345796c8dcSSimon Schubert {
3355796c8dcSSimon Schubert   if (annotation_level == 2)
3365796c8dcSSimon Schubert     printf_filtered (("\n\032\032display-begin\n"));
3375796c8dcSSimon Schubert }
3385796c8dcSSimon Schubert 
3395796c8dcSSimon Schubert void
annotate_display_number_end(void)3405796c8dcSSimon Schubert annotate_display_number_end (void)
3415796c8dcSSimon Schubert {
3425796c8dcSSimon Schubert   if (annotation_level == 2)
3435796c8dcSSimon Schubert     printf_filtered (("\n\032\032display-number-end\n"));
3445796c8dcSSimon Schubert }
3455796c8dcSSimon Schubert 
3465796c8dcSSimon Schubert void
annotate_display_format(void)3475796c8dcSSimon Schubert annotate_display_format (void)
3485796c8dcSSimon Schubert {
3495796c8dcSSimon Schubert   if (annotation_level == 2)
3505796c8dcSSimon Schubert     printf_filtered (("\n\032\032display-format\n"));
3515796c8dcSSimon Schubert }
3525796c8dcSSimon Schubert 
3535796c8dcSSimon Schubert void
annotate_display_expression(void)3545796c8dcSSimon Schubert annotate_display_expression (void)
3555796c8dcSSimon Schubert {
3565796c8dcSSimon Schubert   if (annotation_level == 2)
3575796c8dcSSimon Schubert     printf_filtered (("\n\032\032display-expression\n"));
3585796c8dcSSimon Schubert }
3595796c8dcSSimon Schubert 
3605796c8dcSSimon Schubert void
annotate_display_expression_end(void)3615796c8dcSSimon Schubert annotate_display_expression_end (void)
3625796c8dcSSimon Schubert {
3635796c8dcSSimon Schubert   if (annotation_level == 2)
3645796c8dcSSimon Schubert     printf_filtered (("\n\032\032display-expression-end\n"));
3655796c8dcSSimon Schubert }
3665796c8dcSSimon Schubert 
3675796c8dcSSimon Schubert void
annotate_display_value(void)3685796c8dcSSimon Schubert annotate_display_value (void)
3695796c8dcSSimon Schubert {
3705796c8dcSSimon Schubert   if (annotation_level == 2)
3715796c8dcSSimon Schubert     printf_filtered (("\n\032\032display-value\n"));
3725796c8dcSSimon Schubert }
3735796c8dcSSimon Schubert 
3745796c8dcSSimon Schubert void
annotate_display_end(void)3755796c8dcSSimon Schubert annotate_display_end (void)
3765796c8dcSSimon Schubert {
3775796c8dcSSimon Schubert   if (annotation_level == 2)
3785796c8dcSSimon Schubert     printf_filtered (("\n\032\032display-end\n"));
3795796c8dcSSimon Schubert }
3805796c8dcSSimon Schubert 
3815796c8dcSSimon Schubert void
annotate_arg_begin(void)3825796c8dcSSimon Schubert annotate_arg_begin (void)
3835796c8dcSSimon Schubert {
3845796c8dcSSimon Schubert   if (annotation_level == 2)
3855796c8dcSSimon Schubert     printf_filtered (("\n\032\032arg-begin\n"));
3865796c8dcSSimon Schubert }
3875796c8dcSSimon Schubert 
3885796c8dcSSimon Schubert void
annotate_arg_name_end(void)3895796c8dcSSimon Schubert annotate_arg_name_end (void)
3905796c8dcSSimon Schubert {
3915796c8dcSSimon Schubert   if (annotation_level == 2)
3925796c8dcSSimon Schubert     printf_filtered (("\n\032\032arg-name-end\n"));
3935796c8dcSSimon Schubert }
3945796c8dcSSimon Schubert 
3955796c8dcSSimon Schubert void
annotate_arg_value(struct type * type)3965796c8dcSSimon Schubert annotate_arg_value (struct type *type)
3975796c8dcSSimon Schubert {
3985796c8dcSSimon Schubert   if (annotation_level == 2)
3995796c8dcSSimon Schubert     {
4005796c8dcSSimon Schubert       printf_filtered (("\n\032\032arg-value "));
4015796c8dcSSimon Schubert       print_value_flags (type);
4025796c8dcSSimon Schubert       printf_filtered (("\n"));
4035796c8dcSSimon Schubert     }
4045796c8dcSSimon Schubert }
4055796c8dcSSimon Schubert 
4065796c8dcSSimon Schubert void
annotate_arg_end(void)4075796c8dcSSimon Schubert annotate_arg_end (void)
4085796c8dcSSimon Schubert {
4095796c8dcSSimon Schubert   if (annotation_level == 2)
4105796c8dcSSimon Schubert     printf_filtered (("\n\032\032arg-end\n"));
4115796c8dcSSimon Schubert }
4125796c8dcSSimon Schubert 
4135796c8dcSSimon Schubert void
annotate_source(char * filename,int line,int character,int mid,struct gdbarch * gdbarch,CORE_ADDR pc)4145796c8dcSSimon Schubert annotate_source (char *filename, int line, int character, int mid,
4155796c8dcSSimon Schubert 		 struct gdbarch *gdbarch, CORE_ADDR pc)
4165796c8dcSSimon Schubert {
4175796c8dcSSimon Schubert   if (annotation_level > 1)
4185796c8dcSSimon Schubert     printf_filtered (("\n\032\032source "));
4195796c8dcSSimon Schubert   else
4205796c8dcSSimon Schubert     printf_filtered (("\032\032"));
4215796c8dcSSimon Schubert 
4225796c8dcSSimon Schubert   printf_filtered (("%s:%d:%d:%s:%s\n"), filename, line, character,
4235796c8dcSSimon Schubert 		   mid ? "middle" : "beg", paddress (gdbarch, pc));
4245796c8dcSSimon Schubert }
4255796c8dcSSimon Schubert 
4265796c8dcSSimon Schubert void
annotate_frame_begin(int level,struct gdbarch * gdbarch,CORE_ADDR pc)4275796c8dcSSimon Schubert annotate_frame_begin (int level, struct gdbarch *gdbarch, CORE_ADDR pc)
4285796c8dcSSimon Schubert {
4295796c8dcSSimon Schubert   if (annotation_level > 1)
4305796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-begin %d %s\n"),
4315796c8dcSSimon Schubert 		     level, paddress (gdbarch, pc));
4325796c8dcSSimon Schubert }
4335796c8dcSSimon Schubert 
4345796c8dcSSimon Schubert void
annotate_function_call(void)4355796c8dcSSimon Schubert annotate_function_call (void)
4365796c8dcSSimon Schubert {
4375796c8dcSSimon Schubert   if (annotation_level == 2)
4385796c8dcSSimon Schubert     printf_filtered (("\n\032\032function-call\n"));
4395796c8dcSSimon Schubert }
4405796c8dcSSimon Schubert 
4415796c8dcSSimon Schubert void
annotate_signal_handler_caller(void)4425796c8dcSSimon Schubert annotate_signal_handler_caller (void)
4435796c8dcSSimon Schubert {
4445796c8dcSSimon Schubert   if (annotation_level == 2)
4455796c8dcSSimon Schubert     printf_filtered (("\n\032\032signal-handler-caller\n"));
4465796c8dcSSimon Schubert }
4475796c8dcSSimon Schubert 
4485796c8dcSSimon Schubert void
annotate_frame_address(void)4495796c8dcSSimon Schubert annotate_frame_address (void)
4505796c8dcSSimon Schubert {
4515796c8dcSSimon Schubert   if (annotation_level == 2)
4525796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-address\n"));
4535796c8dcSSimon Schubert }
4545796c8dcSSimon Schubert 
4555796c8dcSSimon Schubert void
annotate_frame_address_end(void)4565796c8dcSSimon Schubert annotate_frame_address_end (void)
4575796c8dcSSimon Schubert {
4585796c8dcSSimon Schubert   if (annotation_level == 2)
4595796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-address-end\n"));
4605796c8dcSSimon Schubert }
4615796c8dcSSimon Schubert 
4625796c8dcSSimon Schubert void
annotate_frame_function_name(void)4635796c8dcSSimon Schubert annotate_frame_function_name (void)
4645796c8dcSSimon Schubert {
4655796c8dcSSimon Schubert   if (annotation_level == 2)
4665796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-function-name\n"));
4675796c8dcSSimon Schubert }
4685796c8dcSSimon Schubert 
4695796c8dcSSimon Schubert void
annotate_frame_args(void)4705796c8dcSSimon Schubert annotate_frame_args (void)
4715796c8dcSSimon Schubert {
4725796c8dcSSimon Schubert   if (annotation_level == 2)
4735796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-args\n"));
4745796c8dcSSimon Schubert }
4755796c8dcSSimon Schubert 
4765796c8dcSSimon Schubert void
annotate_frame_source_begin(void)4775796c8dcSSimon Schubert annotate_frame_source_begin (void)
4785796c8dcSSimon Schubert {
4795796c8dcSSimon Schubert   if (annotation_level == 2)
4805796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-source-begin\n"));
4815796c8dcSSimon Schubert }
4825796c8dcSSimon Schubert 
4835796c8dcSSimon Schubert void
annotate_frame_source_file(void)4845796c8dcSSimon Schubert annotate_frame_source_file (void)
4855796c8dcSSimon Schubert {
4865796c8dcSSimon Schubert   if (annotation_level == 2)
4875796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-source-file\n"));
4885796c8dcSSimon Schubert }
4895796c8dcSSimon Schubert 
4905796c8dcSSimon Schubert void
annotate_frame_source_file_end(void)4915796c8dcSSimon Schubert annotate_frame_source_file_end (void)
4925796c8dcSSimon Schubert {
4935796c8dcSSimon Schubert   if (annotation_level == 2)
4945796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-source-file-end\n"));
4955796c8dcSSimon Schubert }
4965796c8dcSSimon Schubert 
4975796c8dcSSimon Schubert void
annotate_frame_source_line(void)4985796c8dcSSimon Schubert annotate_frame_source_line (void)
4995796c8dcSSimon Schubert {
5005796c8dcSSimon Schubert   if (annotation_level == 2)
5015796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-source-line\n"));
5025796c8dcSSimon Schubert }
5035796c8dcSSimon Schubert 
5045796c8dcSSimon Schubert void
annotate_frame_source_end(void)5055796c8dcSSimon Schubert annotate_frame_source_end (void)
5065796c8dcSSimon Schubert {
5075796c8dcSSimon Schubert   if (annotation_level == 2)
5085796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-source-end\n"));
5095796c8dcSSimon Schubert }
5105796c8dcSSimon Schubert 
5115796c8dcSSimon Schubert void
annotate_frame_where(void)5125796c8dcSSimon Schubert annotate_frame_where (void)
5135796c8dcSSimon Schubert {
5145796c8dcSSimon Schubert   if (annotation_level == 2)
5155796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-where\n"));
5165796c8dcSSimon Schubert }
5175796c8dcSSimon Schubert 
5185796c8dcSSimon Schubert void
annotate_frame_end(void)5195796c8dcSSimon Schubert annotate_frame_end (void)
5205796c8dcSSimon Schubert {
5215796c8dcSSimon Schubert   if (annotation_level == 2)
5225796c8dcSSimon Schubert     printf_filtered (("\n\032\032frame-end\n"));
5235796c8dcSSimon Schubert }
5245796c8dcSSimon Schubert 
5255796c8dcSSimon Schubert void
annotate_array_section_begin(int idx,struct type * elttype)526a45ae5f8SJohn Marino annotate_array_section_begin (int idx, struct type *elttype)
5275796c8dcSSimon Schubert {
5285796c8dcSSimon Schubert   if (annotation_level == 2)
5295796c8dcSSimon Schubert     {
530a45ae5f8SJohn Marino       printf_filtered (("\n\032\032array-section-begin %d "), idx);
5315796c8dcSSimon Schubert       print_value_flags (elttype);
5325796c8dcSSimon Schubert       printf_filtered (("\n"));
5335796c8dcSSimon Schubert     }
5345796c8dcSSimon Schubert }
5355796c8dcSSimon Schubert 
5365796c8dcSSimon Schubert void
annotate_elt_rep(unsigned int repcount)5375796c8dcSSimon Schubert annotate_elt_rep (unsigned int repcount)
5385796c8dcSSimon Schubert {
5395796c8dcSSimon Schubert   if (annotation_level == 2)
5405796c8dcSSimon Schubert     printf_filtered (("\n\032\032elt-rep %u\n"), repcount);
5415796c8dcSSimon Schubert }
5425796c8dcSSimon Schubert 
5435796c8dcSSimon Schubert void
annotate_elt_rep_end(void)5445796c8dcSSimon Schubert annotate_elt_rep_end (void)
5455796c8dcSSimon Schubert {
5465796c8dcSSimon Schubert   if (annotation_level == 2)
5475796c8dcSSimon Schubert     printf_filtered (("\n\032\032elt-rep-end\n"));
5485796c8dcSSimon Schubert }
5495796c8dcSSimon Schubert 
5505796c8dcSSimon Schubert void
annotate_elt(void)5515796c8dcSSimon Schubert annotate_elt (void)
5525796c8dcSSimon Schubert {
5535796c8dcSSimon Schubert   if (annotation_level == 2)
5545796c8dcSSimon Schubert     printf_filtered (("\n\032\032elt\n"));
5555796c8dcSSimon Schubert }
5565796c8dcSSimon Schubert 
5575796c8dcSSimon Schubert void
annotate_array_section_end(void)5585796c8dcSSimon Schubert annotate_array_section_end (void)
5595796c8dcSSimon Schubert {
5605796c8dcSSimon Schubert   if (annotation_level == 2)
5615796c8dcSSimon Schubert     printf_filtered (("\n\032\032array-section-end\n"));
5625796c8dcSSimon Schubert }
5635796c8dcSSimon Schubert 
564*ef5ccd6cSJohn Marino /* Called when GDB is about to display the prompt.  Used to reset
565*ef5ccd6cSJohn Marino    annotation suppression whenever we're ready to accept new
566*ef5ccd6cSJohn Marino    frontend/user commands.  */
567*ef5ccd6cSJohn Marino 
568*ef5ccd6cSJohn Marino void
annotate_display_prompt(void)569*ef5ccd6cSJohn Marino annotate_display_prompt (void)
570*ef5ccd6cSJohn Marino {
571*ef5ccd6cSJohn Marino   frames_invalid_emitted = 0;
572*ef5ccd6cSJohn Marino   breakpoints_invalid_emitted = 0;
573*ef5ccd6cSJohn Marino }
574*ef5ccd6cSJohn Marino 
5755796c8dcSSimon Schubert static void
breakpoint_changed(struct breakpoint * b)576a45ae5f8SJohn Marino breakpoint_changed (struct breakpoint *b)
5775796c8dcSSimon Schubert {
578*ef5ccd6cSJohn Marino   if (b->number <= 0)
579*ef5ccd6cSJohn Marino     return;
580*ef5ccd6cSJohn Marino 
581*ef5ccd6cSJohn Marino   annotate_breakpoints_invalid ();
5825796c8dcSSimon Schubert }
5835796c8dcSSimon Schubert 
5845796c8dcSSimon Schubert void
_initialize_annotate(void)5855796c8dcSSimon Schubert _initialize_annotate (void)
5865796c8dcSSimon Schubert {
587*ef5ccd6cSJohn Marino   observer_attach_breakpoint_created (breakpoint_changed);
5885796c8dcSSimon Schubert   observer_attach_breakpoint_deleted (breakpoint_changed);
5895796c8dcSSimon Schubert   observer_attach_breakpoint_modified (breakpoint_changed);
5905796c8dcSSimon Schubert }
591