[rfc] Annotation level THREE

Andrew Cagney
2003-03-11T23:37:13Z

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

To follow through a discussion on gdb@ this patch adds annotation level
three to the GDB sources.

Annotation level three:

- keeps the event notifications from annotation level two
- removes all the output markups

The assumption being that the client can use the more robust
`interpreter mi ...' instead of those obnoxus[sp] markups.

comments?

Yes, this will mean a major revision of the documentation.

With this and its doco in, I think 5.4 is clear to go (or at least try to).

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 15353 bytes --]

2003-03-11 Andrew Cagney <cagney@redhat.com>

* annotate.c: Update copyright.
(annotate_signal_name): Restrict annotation to level 2.
(annotate_breakpoints_headers, annotate_signal_name_end): Ditto.
(annotate_signal_string, annotate_signal_string_end): Ditto.
(annotate_field, annotate_breakpoints_table): Ditto.
(annotate_record, annotate_breakpoints_table_end): Ditto.
(annotate_field_begin, annotate_field_name_end): Ditto.
(annotate_field_end, annotate_field_value): Ditto.
(annotate_error_begin, annotate_value_history_begin): Ditto.
(annotate_value_begin, annotate_value_history_value): Ditto.
(annotate_value_history_end, annotate_value_end): Ditto.
(annotate_display_begin, annotate_display_number_end): Ditto.
(annotate_display_format, annotate_display_expression): Ditto.
(annotate_display_expression_end, annotate_display_value): Ditto.
(annotate_display_end, annotate_arg_begin): Ditto.
(annotate_arg_name_end, annotate_arg_value): Ditto.
(annotate_arg_end, annotate_source): Ditto.
(annotate_frame_begin, annotate_function_call): Ditto.
(annotate_signal_handler_caller, annotate_frame_address): Ditto.
(annotate_frame_address_end, annotate_frame_function_name): Ditto.
(annotate_frame_args, annotate_frame_source_begin): Ditto.
(annotate_frame_source_file, annotate_frame_source_file_end): Ditto.
(annotate_frame_source_line, annotate_frame_source_end): Ditto.
(annotate_frame_where, annotate_frame_end): Ditto.
(annotate_array_section_begin, annotate_elt_rep): Ditto.
(annotate_elt_rep_end, annotate_elt): Ditto.
(annotate_array_section_end): Ditto.
* top.c (command_line_input): Ditto.
* event-top.c (change_annotation_level): Ditto.
(command_line_handler): Ditto.
* utils.c (query, rompt_for_continue): Ditto.

Index: annotate.c
===================================================================
RCS file: /cvs/src/src/gdb/annotate.c,v
retrieving revision 1.5
diff -u -r1.5 annotate.c
--- annotate.c 6 Mar 2001 08:21:05 -0000 1.5
+++ annotate.c 11 Mar 2003 23:28:51 -0000
@@ -1,6 +1,7 @@
/* Annotation routines for GDB.
- Copyright 1986, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1998, 1999,
- 2000 Free Software Foundation, Inc.
+
+ Copyright 1986, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1998,
+ 1999, 2000, 2003 Free Software Foundation, Inc.

This file is part of GDB.

@@ -155,28 +156,28 @@
void
annotate_signal_name (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032signal-name\n");
}

void
annotate_signal_name_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032signal-name-end\n");
}

void
annotate_signal_string (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032signal-string\n");
}

void
annotate_signal_string_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032signal-string-end\n");
}

@@ -193,35 +194,35 @@
void
annotate_breakpoints_headers (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032breakpoints-headers\n");
}

void
annotate_field (int num)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032field %d\n", num);
}

void
annotate_breakpoints_table (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032breakpoints-table\n");
}

void
annotate_record (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032record\n");
}

void
annotate_breakpoints_table_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032breakpoints-table-end\n");
}

@@ -238,7 +239,7 @@
void
annotate_field_begin (struct type *type)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
{
printf_filtered ("\n\032\032field-begin ");
print_value_flags (type);
@@ -249,21 +250,21 @@
void
annotate_field_name_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032field-name-end\n");
}

void
annotate_field_value (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032field-value\n");
}

void
annotate_field_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032field-end\n");
}
\f
@@ -284,14 +285,14 @@
void
annotate_error_begin (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
fprintf_filtered (gdb_stderr, "\n\032\032error-begin\n");
}

void
annotate_value_history_begin (int histindex, struct type *type)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
{
printf_filtered ("\n\032\032value-history-begin %d ", histindex);
print_value_flags (type);
@@ -302,7 +303,7 @@
void
annotate_value_begin (struct type *type)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
{
printf_filtered ("\n\032\032value-begin ");
print_value_flags (type);
@@ -313,91 +314,91 @@
void
annotate_value_history_value (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032value-history-value\n");
}

void
annotate_value_history_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032value-history-end\n");
}

void
annotate_value_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032value-end\n");
}

void
annotate_display_begin (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032display-begin\n");
}

void
annotate_display_number_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032display-number-end\n");
}

void
annotate_display_format (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032display-format\n");
}

void
annotate_display_expression (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032display-expression\n");
}

void
annotate_display_expression_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032display-expression-end\n");
}

void
annotate_display_value (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032display-value\n");
}

void
annotate_display_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032display-end\n");
}

void
annotate_arg_begin (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032arg-begin\n");
}

void
annotate_arg_name_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032arg-name-end\n");
}

void
annotate_arg_value (struct type *type)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
{
printf_filtered ("\n\032\032arg-value ");
print_value_flags (type);
@@ -408,14 +409,16 @@
void
annotate_arg_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032arg-end\n");
}

void
annotate_source (char *filename, int line, int character, int mid, CORE_ADDR pc)
{
- if (annotation_level > 1)
+ if (annotation_level > 2)
+ return;
+ if (annotation_level == 2)
printf_filtered ("\n\032\032source ");
else
printf_filtered ("\032\032");
@@ -430,7 +433,7 @@
void
annotate_frame_begin (int level, CORE_ADDR pc)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
{
printf_filtered ("\n\032\032frame-begin %d 0x", level);
print_address_numeric (pc, 0, gdb_stdout);
@@ -441,98 +444,98 @@
void
annotate_function_call (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032function-call\n");
}

void
annotate_signal_handler_caller (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032signal-handler-caller\n");
}

void
annotate_frame_address (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-address\n");
}

void
annotate_frame_address_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-address-end\n");
}

void
annotate_frame_function_name (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-function-name\n");
}

void
annotate_frame_args (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-args\n");
}

void
annotate_frame_source_begin (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-source-begin\n");
}

void
annotate_frame_source_file (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-source-file\n");
}

void
annotate_frame_source_file_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-source-file-end\n");
}

void
annotate_frame_source_line (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-source-line\n");
}

void
annotate_frame_source_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-source-end\n");
}

void
annotate_frame_where (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-where\n");
}

void
annotate_frame_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032frame-end\n");
}
\f
void
annotate_array_section_begin (int index, struct type *elttype)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
{
printf_filtered ("\n\032\032array-section-begin %d ", index);
print_value_flags (elttype);
@@ -543,28 +546,28 @@
void
annotate_elt_rep (unsigned int repcount)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032elt-rep %u\n", repcount);
}

void
annotate_elt_rep_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032elt-rep-end\n");
}

void
annotate_elt (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032elt\n");
}

void
annotate_array_section_end (void)
{
- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032array-section-end\n");
}

Index: event-top.c
===================================================================
RCS file: /cvs/src/src/gdb/event-top.c,v
retrieving revision 1.26
diff -u -r1.26 event-top.c
--- event-top.c 12 Feb 2003 15:31:30 -0000 1.26
+++ event-top.c 11 Mar 2003 23:28:51 -0000
@@ -325,7 +325,7 @@
return;
}

- if (annotation_level > 1)
+ if (annotation_level == 2)
{
if (!strcmp (PREFIX (0), "") && !strcmp (SUFFIX (0), ""))
{
@@ -613,7 +613,7 @@

int repeat = (instream == stdin);

- if (annotation_level > 1 && instream == stdin)
+ if (annotation_level == 2 && instream == stdin)
{
printf_unfiltered ("\n\032\032post-");
printf_unfiltered (async_annotation_suffix);
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.71
diff -u -r1.71 top.c
--- top.c 6 Feb 2003 01:19:12 -0000 1.71
+++ top.c 11 Mar 2003 23:28:51 -0000
@@ -1144,7 +1144,7 @@
if (annotation_suffix == NULL)
annotation_suffix = "";

- if (annotation_level > 1 && instream == stdin)
+ if (annotation_level == 2 && instream == stdin)
{
local_prompt = alloca ((prompt_arg == NULL ? 0 : strlen (prompt_arg))
+ strlen (annotation_suffix) + 40);
@@ -1197,7 +1197,7 @@
error_pre_print = source_error;
}

- if (annotation_level > 1 && instream == stdin)
+ if (annotation_level == 2 && instream == stdin)
{
printf_unfiltered ("\n\032\032pre-");
printf_unfiltered (annotation_suffix);
@@ -1218,7 +1218,7 @@
rl = gdb_readline (local_prompt);
}

- if (annotation_level > 1 && instream == stdin)
+ if (annotation_level == 2 && instream == stdin)
{
printf_unfiltered ("\n\032\032post-");
printf_unfiltered (annotation_suffix);
@@ -1932,8 +1932,8 @@
PREFIX (0) = "";
PROMPT (0) = savestring (DEFAULT_PROMPT, strlen (DEFAULT_PROMPT));
SUFFIX (0) = "";
- /* Set things up for annotation_level > 1, if the user ever decides
- to use it. */
+ /* Set things up for annotation_level == 2, if the user ever
+ decides to use it. */
async_annotation_suffix = "prompt";
/* Set the variable associated with the setshow prompt command. */
new_async_prompt = savestring (PROMPT (0), strlen (PROMPT (0)));
@@ -1941,7 +1941,7 @@
/* If gdb was started with --annotate=2, this is equivalent to
the user entering the command 'set annotate 2' at the gdb
prompt, so we need to do extra processing. */
- if (annotation_level > 1)
+ if (annotation_level == 2)
set_async_annotation_level (NULL, 0, NULL);
}
gdb_prompt_escape = 0; /* default to none. */
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.98
diff -u -r1.98 utils.c
--- utils.c 26 Feb 2003 14:35:19 -0000 1.98
+++ utils.c 11 Mar 2003 23:28:52 -0000
@@ -1301,13 +1301,13 @@
wrap_here (""); /* Flush any buffered output */
gdb_flush (gdb_stdout);

- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032pre-query\n");

vfprintf_filtered (gdb_stdout, ctlstr, args);
printf_filtered ("(y or n) ");

- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032query\n");

wrap_here ("");
@@ -1344,7 +1344,7 @@
printf_filtered ("Please answer y or n.\n");
}

- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_filtered ("\n\032\032post-query\n");
return retval;
}
@@ -1687,12 +1687,12 @@
char *ignore;
char cont_prompt[120];

- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_unfiltered ("\n\032\032pre-prompt-for-continue\n");

strcpy (cont_prompt,
"---Type <return> to continue, or q <return> to quit---");
- if (annotation_level > 1)
+ if (annotation_level == 2)
strcat (cont_prompt, "\n\032\032prompt-for-continue\n");

/* We must do this *before* we call gdb_readline, else it will eventually
@@ -1713,7 +1713,7 @@
out to DOS. */
ignore = gdb_readline_wrapper (cont_prompt);

- if (annotation_level > 1)
+ if (annotation_level == 2)
printf_unfiltered ("\n\032\032post-prompt-for-continue\n");

if (ignore)