This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfc] s/ui_out_list/ui_out_tupple/
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [rfc] s/ui_out_list/ui_out_tupple/
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 11 May 2001 14:40:35 -0400
Hello,
The attatched patch is a deliberate step sideways for the UI/MI code.
At present, the UI code uses ui_out_list*() to create the output while
the MI code outputs tupples. The attatched, patch changes the UI code so
that it it creates tupples instead of lists making the UI and MI
consistent. To ease my pain, I added ui_out_tupple*() wrappers.
By taking a step sideways, I've removed the need to review/update
individual MI commands in a single hit. Instead it can be done
incrementally.
Andrew
Index: ChangeLog
Fri May 11 13:32:50 2001 Andrew Cagney <cagney@b1.cygnus.com>
* breakpoint.c: Replace ui_out_list_begin, ui_out_list_end and
make_cleanup_ui_out_list_end with ui_out_tupple_begin,
ui_out_tupple_end and make_cleanup_ui_out_tupple_begin_end.
* cli/cli-setshow.c: Ditto.
* printcmd.c: Ditto.
* stack.c: Ditto.
* ui-out.c (ui_out_list_begin): Delete ``lstid'' parameter.
(ui_out_tupple_begin): New function.
(ui_out_tupple_end): New function.
(ui_out_tupple_begin_end): New function.
(make_cleanup_ui_out_list_begin_end): Replace
make_cleanup_ui_out_list_end function.
* ui-out.h (ui_out_list_begin): Update declaration.
(make_cleanup_ui_out_list_begin_end): Replace
make_cleanup_ui_out_list_end declaration.
(ui_out_tupple_begin, ui_out_tupple_end): Declare.
(ui_out_tupple_begin_end): Declare.
Index: mi/ChangeLog
Fri May 11 13:55:07 2001 Andrew Cagney <cagney@b1.cygnus.com>
* mi-cmd-var.c: Replace ui_out_list_begin, ui_out_list_end and
make_cleanup_ui_out_list_end with ui_out_tupple_begin,
ui_out_tupple_end and make_cleanup_ui_out_tupple_begin_end.
* mi-cmd-stack.c: Ditto.
* mi-cmd-disas.c: Ditto.
* mi-main.c: Ditto.
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.35
diff -p -r1.35 breakpoint.c
*** breakpoint.c 2001/05/06 22:22:02 1.35
--- breakpoint.c 2001/05/11 18:06:58
*************** print_it_typical (bpstat bs)
*** 2030,2043 ****
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
ui_out_field_string (uiout, "reason", "watchpoint-trigger");
mention (bs->breakpoint_at);
! ui_out_list_begin (uiout, "value");
ui_out_text (uiout, "\nOld value = ");
value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
ui_out_field_stream (uiout, "old", stb);
ui_out_text (uiout, "\nNew value = ");
value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default);
ui_out_field_stream (uiout, "new", stb);
! ui_out_list_end (uiout);
ui_out_text (uiout, "\n");
#else
mention (bs->breakpoint_at);
--- 2030,2043 ----
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
ui_out_field_string (uiout, "reason", "watchpoint-trigger");
mention (bs->breakpoint_at);
! ui_out_tupple_begin (uiout, "value");
ui_out_text (uiout, "\nOld value = ");
value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
ui_out_field_stream (uiout, "old", stb);
ui_out_text (uiout, "\nNew value = ");
value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default);
ui_out_field_stream (uiout, "new", stb);
! ui_out_tupple_end (uiout);
ui_out_text (uiout, "\n");
#else
mention (bs->breakpoint_at);
*************** print_it_typical (bpstat bs)
*** 2060,2070 ****
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
ui_out_field_string (uiout, "reason", "read-watchpoint-trigger");
mention (bs->breakpoint_at);
! ui_out_list_begin (uiout, "value");
ui_out_text (uiout, "\nValue = ");
value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default);
ui_out_field_stream (uiout, "value", stb);
! ui_out_list_end (uiout);
ui_out_text (uiout, "\n");
#else
mention (bs->breakpoint_at);
--- 2060,2070 ----
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
ui_out_field_string (uiout, "reason", "read-watchpoint-trigger");
mention (bs->breakpoint_at);
! ui_out_tupple_begin (uiout, "value");
ui_out_text (uiout, "\nValue = ");
value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default);
ui_out_field_stream (uiout, "value", stb);
! ui_out_tupple_end (uiout);
ui_out_text (uiout, "\n");
#else
mention (bs->breakpoint_at);
*************** print_it_typical (bpstat bs)
*** 2084,2090 ****
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
mention (bs->breakpoint_at);
! ui_out_list_begin (uiout, "value");
ui_out_text (uiout, "\nOld value = ");
value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
ui_out_field_stream (uiout, "old", stb);
--- 2084,2090 ----
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
mention (bs->breakpoint_at);
! ui_out_tupple_begin (uiout, "value");
ui_out_text (uiout, "\nOld value = ");
value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
ui_out_field_stream (uiout, "old", stb);
*************** print_it_typical (bpstat bs)
*** 2097,2108 ****
mention (bs->breakpoint_at);
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
! ui_out_list_begin (uiout, "value");
ui_out_text (uiout, "\nValue = ");
}
value_print (bs->breakpoint_at->val, stb->stream, 0,Val_pretty_default);
ui_out_field_stream (uiout, "new", stb);
! ui_out_list_end (uiout);
ui_out_text (uiout, "\n");
#else
if (bs->old_val != NULL)
--- 2097,2108 ----
mention (bs->breakpoint_at);
if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
! ui_out_tupple_begin (uiout, "value");
ui_out_text (uiout, "\nValue = ");
}
value_print (bs->breakpoint_at->val, stb->stream, 0,Val_pretty_default);
ui_out_field_stream (uiout, "new", stb);
! ui_out_tupple_end (uiout);
ui_out_text (uiout, "\n");
#else
if (bs->old_val != NULL)
*************** print_one_breakpoint (struct breakpoint
*** 3126,3132 ****
annotate_record ();
#ifdef UI_OUT
! ui_out_list_begin (uiout, "bkpt");
#endif
/* 1 */
--- 3126,3132 ----
annotate_record ();
#ifdef UI_OUT
! ui_out_tupple_begin (uiout, "bkpt");
#endif
/* 1 */
*************** print_one_breakpoint (struct breakpoint
*** 3490,3498 ****
{
annotate_field (9);
#ifdef UI_OUT
! ui_out_list_begin (uiout, "script");
print_command_lines (uiout, l, 4);
! ui_out_list_end (uiout);
#else
while (l)
{
--- 3490,3498 ----
{
annotate_field (9);
#ifdef UI_OUT
! ui_out_tupple_begin (uiout, "script");
print_command_lines (uiout, l, 4);
! ui_out_tupple_end (uiout);
#else
while (l)
{
*************** print_one_breakpoint (struct breakpoint
*** 3502,3508 ****
#endif
}
#ifdef UI_OUT
! ui_out_list_end (uiout);
do_cleanups (old_chain);
#endif
}
--- 3502,3508 ----
#endif
}
#ifdef UI_OUT
! ui_out_tupple_end (uiout);
do_cleanups (old_chain);
#endif
}
*************** mention (struct breakpoint *b)
*** 4385,4405 ****
#ifdef UI_OUT
case bp_watchpoint:
ui_out_text (uiout, "Watchpoint ");
! ui_out_list_begin (uiout, "wpt");
ui_out_field_int (uiout, "number", b->number);
ui_out_text (uiout, ": ");
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "exp", stb);
! ui_out_list_end (uiout);
break;
case bp_hardware_watchpoint:
ui_out_text (uiout, "Hardware watchpoint ");
! ui_out_list_begin (uiout, "wpt");
ui_out_field_int (uiout, "number", b->number);
ui_out_text (uiout, ": ");
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "exp", stb);
! ui_out_list_end (uiout);
break;
#else
case bp_watchpoint:
--- 4385,4405 ----
#ifdef UI_OUT
case bp_watchpoint:
ui_out_text (uiout, "Watchpoint ");
! ui_out_tupple_begin (uiout, "wpt");
ui_out_field_int (uiout, "number", b->number);
ui_out_text (uiout, ": ");
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "exp", stb);
! ui_out_tupple_end (uiout);
break;
case bp_hardware_watchpoint:
ui_out_text (uiout, "Hardware watchpoint ");
! ui_out_tupple_begin (uiout, "wpt");
ui_out_field_int (uiout, "number", b->number);
ui_out_text (uiout, ": ");
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "exp", stb);
! ui_out_tupple_end (uiout);
break;
#else
case bp_watchpoint:
*************** mention (struct breakpoint *b)
*** 4414,4434 ****
#ifdef UI_OUT
case bp_read_watchpoint:
ui_out_text (uiout, "Hardware read watchpoint ");
! ui_out_list_begin (uiout, "hw-rwpt");
ui_out_field_int (uiout, "number", b->number);
ui_out_text (uiout, ": ");
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "exp", stb);
! ui_out_list_end (uiout);
break;
case bp_access_watchpoint:
ui_out_text (uiout, "Hardware access (read/write) watchpoint ");
! ui_out_list_begin (uiout, "hw-awpt");
ui_out_field_int (uiout, "number", b->number);
ui_out_text (uiout, ": ");
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "exp", stb);
! ui_out_list_end (uiout);
break;
#else
case bp_read_watchpoint:
--- 4414,4434 ----
#ifdef UI_OUT
case bp_read_watchpoint:
ui_out_text (uiout, "Hardware read watchpoint ");
! ui_out_tupple_begin (uiout, "hw-rwpt");
ui_out_field_int (uiout, "number", b->number);
ui_out_text (uiout, ": ");
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "exp", stb);
! ui_out_tupple_end (uiout);
break;
case bp_access_watchpoint:
ui_out_text (uiout, "Hardware access (read/write) watchpoint ");
! ui_out_tupple_begin (uiout, "hw-awpt");
ui_out_field_int (uiout, "number", b->number);
ui_out_text (uiout, ": ");
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "exp", stb);
! ui_out_tupple_end (uiout);
break;
#else
case bp_read_watchpoint:
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.19
diff -p -r1.19 printcmd.c
*** printcmd.c 2001/04/08 17:55:13 1.19
--- printcmd.c 2001/05/11 18:06:58
*************** print_frame_args (struct symbol *func, s
*** 1908,1915 ****
annotate_arg_begin ();
! ui_out_list_begin (uiout, NULL);
! list_chain = make_cleanup_ui_out_list_end (uiout);
fprintf_symbol_filtered (stb->stream, SYMBOL_SOURCE_NAME (sym),
SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI);
ui_out_field_stream (uiout, "name", stb);
--- 1908,1914 ----
annotate_arg_begin ();
! list_chain = make_cleanup_ui_out_tupple_begin_end (uiout, NULL);
fprintf_symbol_filtered (stb->stream, SYMBOL_SOURCE_NAME (sym),
SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI);
ui_out_field_stream (uiout, "name", stb);
*************** print_frame_args (struct symbol *func, s
*** 1952,1958 ****
else
ui_out_text (uiout, "???");
! /* Invoke ui_out_list_end. */
do_cleanups (list_chain);
#else
val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0,
--- 1951,1957 ----
else
ui_out_text (uiout, "???");
! /* Invoke ui_out_tupple_end. */
do_cleanups (list_chain);
#else
val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0,
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.19
diff -p -r1.19 stack.c
*** stack.c 2001/04/08 17:55:13 1.19
--- stack.c 2001/05/11 18:06:59
*************** print_frame (struct frame_info *fi,
*** 531,538 ****
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
#ifdef UI_OUT
! ui_out_list_begin (uiout, "frame");
! list_chain = make_cleanup_ui_out_list_end (uiout);
#endif
if (level >= 0)
--- 531,537 ----
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
#ifdef UI_OUT
! list_chain = make_cleanup_ui_out_tupple_begin_end (uiout, "frame");
#endif
if (level >= 0)
*************** print_frame (struct frame_info *fi,
*** 587,598 ****
args.func = func;
args.stream = gdb_stdout;
#ifdef UI_OUT
! ui_out_list_begin (uiout, "args");
! args_list_chain = make_cleanup_ui_out_list_end (uiout);
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
/* FIXME: args must be a list. If one argument is a string it will
have " that will not be properly escaped. */
! /* Invoke ui_out_list_end. */
do_cleanups (args_list_chain);
#else
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
--- 586,596 ----
args.func = func;
args.stream = gdb_stdout;
#ifdef UI_OUT
! args_list_chain = make_cleanup_ui_out_tupple_begin_end (uiout, "args");
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
/* FIXME: args must be a list. If one argument is a string it will
have " that will not be properly escaped. */
! /* Invoke ui_out_tupple_end. */
do_cleanups (args_list_chain);
#else
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
*************** print_frame (struct frame_info *fi,
*** 649,655 ****
#endif /* PC_SOLIB */
#ifdef UI_OUT
! /* do_cleanups will call ui_out_list_end() for us. */
do_cleanups (list_chain);
ui_out_text (uiout, "\n");
do_cleanups (old_chain);
--- 647,653 ----
#endif /* PC_SOLIB */
#ifdef UI_OUT
! /* do_cleanups will call ui_out_tupple_end() for us. */
do_cleanups (list_chain);
ui_out_text (uiout, "\n");
do_cleanups (old_chain);
Index: ui-out.c
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.c,v
retrieving revision 1.11
diff -p -r1.11 ui-out.c
*** ui-out.c 2001/05/10 21:30:37 1.11
--- ui-out.c 2001/05/11 18:06:59
*************** specified after table_body.");
*** 332,344 ****
}
void
! ui_out_list_begin (struct ui_out *uiout,
! char *id)
{
! ui_out_begin (uiout, ui_out_type_list, id);
}
void
ui_out_end (struct ui_out *uiout,
enum ui_out_type type)
{
--- 332,349 ----
}
void
! ui_out_list_begin (struct ui_out *uiout)
{
! ui_out_begin (uiout, ui_out_type_list, NULL);
}
void
+ ui_out_tupple_begin (struct ui_out *uiout, const char *id)
+ {
+ ui_out_begin (uiout, ui_out_type_tupple, id);
+ }
+
+ void
ui_out_end (struct ui_out *uiout,
enum ui_out_type type)
{
*************** ui_out_list_end (struct ui_out *uiout)
*** 352,357 ****
--- 357,368 ----
ui_out_end (uiout, ui_out_type_list);
}
+ void
+ ui_out_tupple_end (struct ui_out *uiout)
+ {
+ ui_out_end (uiout, ui_out_type_tupple);
+ }
+
struct ui_out_end_cleanup_data
{
struct ui_out *uiout;
*************** make_cleanup_ui_out_begin_end (struct ui
*** 386,393 ****
return make_cleanup_ui_out_end (uiout, type);
}
struct cleanup *
! make_cleanup_ui_out_list_end (struct ui_out *uiout)
{
return make_cleanup_ui_out_end (uiout, ui_out_type_list);
}
--- 397,412 ----
return make_cleanup_ui_out_end (uiout, type);
}
+ struct cleanup *
+ make_cleanup_ui_out_tupple_begin_end (struct ui_out *uiout,
+ const char *id)
+ {
+ ui_out_tupple_begin (uiout, id);
+ return make_cleanup_ui_out_end (uiout, ui_out_type_tupple);
+ }
+
struct cleanup *
! make_cleanup_ui_out_list_begin_end (struct ui_out *uiout)
{
return make_cleanup_ui_out_end (uiout, ui_out_type_list);
}
Index: ui-out.h
===================================================================
RCS file: /cvs/src/src/gdb/ui-out.h,v
retrieving revision 1.8
diff -p -r1.8 ui-out.h
*** ui-out.h 2001/05/10 21:30:37 1.8
--- ui-out.h 2001/05/11 18:06:59
*************** extern void ui_out_table_end (struct ui_
*** 101,111 ****
/* Compatibility wrappers, new code should use ui_out_begin() and
ui_out_end(). */
! extern void ui_out_list_begin (struct ui_out *uiout, char *lstid);
extern void ui_out_list_end (struct ui_out *uiout);
! extern struct cleanup *make_cleanup_ui_out_list_end (struct ui_out *uiout);
extern void ui_out_field_int (struct ui_out *uiout, char *fldname, int value);
--- 101,118 ----
/* Compatibility wrappers, new code should use ui_out_begin() and
ui_out_end(). */
! extern void ui_out_list_begin (struct ui_out *uiout);
extern void ui_out_list_end (struct ui_out *uiout);
! extern struct cleanup *make_cleanup_ui_out_list_begin_end (struct ui_out *uiout);
!
! extern void ui_out_tupple_begin (struct ui_out *uiout, const char *id);
!
! extern void ui_out_tupple_end (struct ui_out *uiout);
!
! extern struct cleanup *make_cleanup_ui_out_tupple_begin_end (struct ui_out *uiout,
! const char *id);
extern void ui_out_field_int (struct ui_out *uiout, char *fldname, int value);
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.3
diff -p -r1.3 cli-setshow.c
*** cli-setshow.c 2001/02/08 06:03:54 1.3
--- cli-setshow.c 2001/05/11 18:06:59
*************** void
*** 422,428 ****
cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
{
#ifdef UI_OUT
! ui_out_list_begin (uiout, "showlist");
#endif
for (; list != NULL; list = list->next)
{
--- 422,428 ----
cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
{
#ifdef UI_OUT
! ui_out_tupple_begin (uiout, "showlist");
#endif
for (; list != NULL; list = list->next)
{
*************** cmd_show_list (struct cmd_list_element *
*** 431,449 ****
#ifdef UI_OUT
if (list->prefixlist && !list->abbrev_flag)
{
! ui_out_list_begin (uiout, "optionlist");
ui_out_field_string (uiout, "prefix", list->prefixname + 5);
cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
! ui_out_list_end (uiout);
}
if (list->type == show_cmd)
{
! ui_out_list_begin (uiout, "option");
ui_out_text (uiout, prefix);
ui_out_field_string (uiout, "name", list->name);
ui_out_text (uiout, ": ");
do_setshow_command ((char *) NULL, from_tty, list);
! ui_out_list_end (uiout);
}
#else
if (list->prefixlist && !list->abbrev_flag)
--- 431,449 ----
#ifdef UI_OUT
if (list->prefixlist && !list->abbrev_flag)
{
! ui_out_tupple_begin (uiout, "optionlist");
ui_out_field_string (uiout, "prefix", list->prefixname + 5);
cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
! ui_out_tupple_end (uiout);
}
if (list->type == show_cmd)
{
! ui_out_tupple_begin (uiout, "option");
ui_out_text (uiout, prefix);
ui_out_field_string (uiout, "name", list->name);
ui_out_text (uiout, ": ");
do_setshow_command ((char *) NULL, from_tty, list);
! ui_out_tupple_end (uiout);
}
#else
if (list->prefixlist && !list->abbrev_flag)
*************** cmd_show_list (struct cmd_list_element *
*** 458,464 ****
#endif
}
#ifdef UI_OUT
! ui_out_list_end (uiout);
#endif
}
--- 458,464 ----
#endif
}
#ifdef UI_OUT
! ui_out_tupple_end (uiout);
#endif
}
Index: mi/mi-cmd-disas.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-disas.c,v
retrieving revision 1.9
diff -p -r1.9 mi-cmd-disas.c
*** mi-cmd-disas.c 2001/03/20 17:19:04 1.9
--- mi-cmd-disas.c 2001/05/11 18:07:03
*************** mi_cmd_disassemble (char *command, char
*** 364,370 ****
for that line. */
next_line = 0; /* Force out first line */
! ui_out_list_begin (uiout, "asm_insns");
num_displayed = 0;
for (i = 0; i < newlines; i++)
{
--- 364,370 ----
for that line. */
next_line = 0; /* Force out first line */
! ui_out_tupple_begin (uiout, "asm_insns");
num_displayed = 0;
for (i = 0; i < newlines; i++)
{
*************** mi_cmd_disassemble (char *command, char
*** 377,383 ****
/* Just one line to print. */
if (next_line == mle[i].line)
{
! ui_out_list_begin (uiout, "src_and_asm_line");
print_source_lines (symtab, next_line, mle[i].line + 1, 0);
}
else
--- 377,383 ----
/* Just one line to print. */
if (next_line == mle[i].line)
{
! ui_out_tupple_begin (uiout, "src_and_asm_line");
print_source_lines (symtab, next_line, mle[i].line + 1, 0);
}
else
*************** mi_cmd_disassemble (char *command, char
*** 385,410 ****
/* Several source lines w/o asm instructions associated. */
for (; next_line < mle[i].line; next_line++)
{
! ui_out_list_begin (uiout, "src_and_asm_line");
print_source_lines (symtab, next_line, mle[i].line + 1, 0);
! ui_out_list_begin (uiout, "line_asm_insn");
! ui_out_list_end (uiout);
! ui_out_list_end (uiout);
}
/* Print the last line and leave list open for
asm instructions to be added. */
! ui_out_list_begin (uiout, "src_and_asm_line");
print_source_lines (symtab, next_line, mle[i].line + 1, 0);
}
}
else
{
! ui_out_list_begin (uiout, "src_and_asm_line");
print_source_lines (symtab, mle[i].line, mle[i].line + 1, 0);
}
next_line = mle[i].line + 1;
! ui_out_list_begin (uiout, "line_asm_insn");
if (i + 1 < newlines && mle[i + 1].line <= mle[i].line)
close_list = 0;
}
--- 385,410 ----
/* Several source lines w/o asm instructions associated. */
for (; next_line < mle[i].line; next_line++)
{
! ui_out_tupple_begin (uiout, "src_and_asm_line");
print_source_lines (symtab, next_line, mle[i].line + 1, 0);
! ui_out_tupple_begin (uiout, "line_asm_insn");
! ui_out_tupple_end (uiout);
! ui_out_tupple_end (uiout);
}
/* Print the last line and leave list open for
asm instructions to be added. */
! ui_out_tupple_begin (uiout, "src_and_asm_line");
print_source_lines (symtab, next_line, mle[i].line + 1, 0);
}
}
else
{
! ui_out_tupple_begin (uiout, "src_and_asm_line");
print_source_lines (symtab, mle[i].line, mle[i].line + 1, 0);
}
next_line = mle[i].line + 1;
! ui_out_tupple_begin (uiout, "line_asm_insn");
if (i + 1 < newlines && mle[i + 1].line <= mle[i].line)
close_list = 0;
}
*************** mi_cmd_disassemble (char *command, char
*** 418,424 ****
else
num_displayed++;
}
! ui_out_list_begin (uiout, NULL);
ui_out_field_core_addr (uiout, "address", pc);
if (!build_address_symbolic (pc, 0, &name, &offset, &filename, &line, &unmapped))
--- 418,424 ----
else
num_displayed++;
}
! ui_out_tupple_begin (uiout, NULL);
ui_out_field_core_addr (uiout, "address", pc);
if (!build_address_symbolic (pc, 0, &name, &offset, &filename, &line, &unmapped))
*************** mi_cmd_disassemble (char *command, char
*** 437,460 ****
pc += (*tm_print_insn) (pc, &di);
ui_out_field_stream (uiout, "inst", stb);
ui_file_rewind (stb->stream);
! ui_out_list_end (uiout);
}
if (close_list)
{
! ui_out_list_end (uiout);
! ui_out_list_end (uiout);
close_list = 0;
}
if (how_many >= 0)
if (num_displayed >= how_many)
break;
}
! ui_out_list_end (uiout);
}
else
{
assembly_only:
! ui_out_list_begin (uiout, "asm_insns");
num_displayed = 0;
for (pc = low; pc < high;)
{
--- 437,460 ----
pc += (*tm_print_insn) (pc, &di);
ui_out_field_stream (uiout, "inst", stb);
ui_file_rewind (stb->stream);
! ui_out_tupple_end (uiout);
}
if (close_list)
{
! ui_out_tupple_end (uiout);
! ui_out_tupple_end (uiout);
close_list = 0;
}
if (how_many >= 0)
if (num_displayed >= how_many)
break;
}
! ui_out_tupple_end (uiout);
}
else
{
assembly_only:
! ui_out_tupple_begin (uiout, "asm_insns");
num_displayed = 0;
for (pc = low; pc < high;)
{
*************** mi_cmd_disassemble (char *command, char
*** 466,472 ****
else
num_displayed++;
}
! ui_out_list_begin (uiout, NULL);
ui_out_field_core_addr (uiout, "address", pc);
if (!build_address_symbolic (pc, 0, &name, &offset, &filename, &line, &unmapped))
--- 466,472 ----
else
num_displayed++;
}
! ui_out_tupple_begin (uiout, NULL);
ui_out_field_core_addr (uiout, "address", pc);
if (!build_address_symbolic (pc, 0, &name, &offset, &filename, &line, &unmapped))
*************** mi_cmd_disassemble (char *command, char
*** 485,493 ****
pc += (*tm_print_insn) (pc, &di);
ui_out_field_stream (uiout, "inst", stb);
ui_file_rewind (stb->stream);
! ui_out_list_end (uiout);
}
! ui_out_list_end (uiout);
}
gdb_flush (gdb_stdout);
--- 485,493 ----
pc += (*tm_print_insn) (pc, &di);
ui_out_field_stream (uiout, "inst", stb);
ui_file_rewind (stb->stream);
! ui_out_tupple_end (uiout);
}
! ui_out_tupple_end (uiout);
}
gdb_flush (gdb_stdout);
Index: mi/mi-cmd-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
retrieving revision 1.4
diff -p -r1.4 mi-cmd-stack.c
*** mi-cmd-stack.c 2001/03/06 08:21:45 1.4
--- mi-cmd-stack.c 2001/05/11 18:07:03
*************** mi_cmd_stack_list_frames (char *command,
*** 77,83 ****
if (fi == NULL)
error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
! ui_out_list_begin (uiout, "stack");
/* Now let;s print the frames up to frame_high, or until there are
frames in the stack. */
--- 77,83 ----
if (fi == NULL)
error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
! ui_out_tupple_begin (uiout, "stack");
/* Now let;s print the frames up to frame_high, or until there are
frames in the stack. */
*************** mi_cmd_stack_list_frames (char *command,
*** 96,102 ****
0 /* args */ );
}
! ui_out_list_end (uiout);
if (i < frame_high)
error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
--- 96,102 ----
0 /* args */ );
}
! ui_out_tupple_end (uiout);
if (i < frame_high)
error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
*************** mi_cmd_stack_list_args (char *command, c
*** 183,189 ****
if (fi == NULL)
error ("mi_cmd_stack_list_args: Not enough frames in stack.");
! ui_out_list_begin (uiout, "stack-args");
/* Now let's print the frames up to frame_high, or until there are
frames in the stack. */
--- 183,189 ----
if (fi == NULL)
error ("mi_cmd_stack_list_args: Not enough frames in stack.");
! ui_out_tupple_begin (uiout, "stack-args");
/* Now let's print the frames up to frame_high, or until there are
frames in the stack. */
*************** mi_cmd_stack_list_args (char *command, c
*** 192,204 ****
i++, fi = get_prev_frame (fi))
{
QUIT;
! ui_out_list_begin (uiout, "frame");
ui_out_field_int (uiout, "level", i);
list_args_or_locals (0, atoi (argv[0]), fi);
! ui_out_list_end (uiout);
}
! ui_out_list_end (uiout);
if (i < frame_high)
error ("mi_cmd_stack_list_args: Not enough frames in stack.");
--- 192,204 ----
i++, fi = get_prev_frame (fi))
{
QUIT;
! ui_out_tupple_begin (uiout, "frame");
ui_out_field_int (uiout, "level", i);
list_args_or_locals (0, atoi (argv[0]), fi);
! ui_out_tupple_end (uiout);
}
! ui_out_tupple_end (uiout);
if (i < frame_high)
error ("mi_cmd_stack_list_args: Not enough frames in stack.");
*************** list_args_or_locals (int locals, int val
*** 222,228 ****
block = get_frame_block (fi);
! ui_out_list_begin (uiout, locals ? "locals" : "args");
while (block != 0)
{
--- 222,228 ----
block = get_frame_block (fi);
! ui_out_tupple_begin (uiout, locals ? "locals" : "args");
while (block != 0)
{
*************** list_args_or_locals (int locals, int val
*** 265,271 ****
if (print_me)
{
if (values)
! ui_out_list_begin (uiout, NULL);
ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
if (values)
--- 265,271 ----
if (print_me)
{
if (values)
! ui_out_tupple_begin (uiout, NULL);
ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
if (values)
*************** list_args_or_locals (int locals, int val
*** 280,286 ****
sym2 = sym;
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
! ui_out_list_end (uiout);
}
}
}
--- 280,286 ----
sym2 = sym;
print_variable_value (sym2, fi, stb->stream);
ui_out_field_stream (uiout, "value", stb);
! ui_out_tupple_end (uiout);
}
}
}
*************** list_args_or_locals (int locals, int val
*** 289,295 ****
else
block = BLOCK_SUPERBLOCK (block);
}
! ui_out_list_end (uiout);
ui_out_stream_delete (stb);
}
--- 289,295 ----
else
block = BLOCK_SUPERBLOCK (block);
}
! ui_out_tupple_end (uiout);
ui_out_stream_delete (stb);
}
Index: mi/mi-cmd-var.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-var.c,v
retrieving revision 1.8
diff -p -r1.8 mi-cmd-var.c
*** mi-cmd-var.c 2001/03/06 08:21:45 1.8
--- mi-cmd-var.c 2001/05/11 18:07:03
*************** mi_cmd_var_list_children (char *command,
*** 273,283 ****
if (numchild <= 0)
return MI_CMD_DONE;
! ui_out_list_begin (uiout, "children");
cc = childlist;
while (*cc != NULL)
{
! ui_out_list_begin (uiout, "child");
ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
--- 273,283 ----
if (numchild <= 0)
return MI_CMD_DONE;
! ui_out_tupple_begin (uiout, "children");
cc = childlist;
while (*cc != NULL)
{
! ui_out_tupple_begin (uiout, "child");
ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
*************** mi_cmd_var_list_children (char *command,
*** 285,294 ****
/* C++ pseudo-variables (public, private, protected) do not have a type */
if (type)
ui_out_field_string (uiout, "type", varobj_get_type (*cc));
! ui_out_list_end (uiout);
cc++;
}
! ui_out_list_end (uiout);
xfree (childlist);
return MI_CMD_DONE;
}
--- 285,294 ----
/* C++ pseudo-variables (public, private, protected) do not have a type */
if (type)
ui_out_field_string (uiout, "type", varobj_get_type (*cc));
! ui_out_tupple_end (uiout);
cc++;
}
! ui_out_tupple_end (uiout);
xfree (childlist);
return MI_CMD_DONE;
}
*************** mi_cmd_var_update (char *command, char *
*** 421,430 ****
if ((*name == '*') && (*(name + 1) == '\0'))
{
nv = varobj_list (&rootlist);
! ui_out_list_begin (uiout, "changelist");
if (nv <= 0)
{
! ui_out_list_end (uiout);
return MI_CMD_DONE;
}
cr = rootlist;
--- 421,430 ----
if ((*name == '*') && (*(name + 1) == '\0'))
{
nv = varobj_list (&rootlist);
! ui_out_tupple_begin (uiout, "changelist");
if (nv <= 0)
{
! ui_out_tupple_end (uiout);
return MI_CMD_DONE;
}
cr = rootlist;
*************** mi_cmd_var_update (char *command, char *
*** 434,440 ****
cr++;
}
xfree (rootlist);
! ui_out_list_end (uiout);
}
else
{
--- 434,440 ----
cr++;
}
xfree (rootlist);
! ui_out_tupple_end (uiout);
}
else
{
*************** mi_cmd_var_update (char *command, char *
*** 443,451 ****
if (var == NULL)
error ("mi_cmd_var_update: Variable object not found");
! ui_out_list_begin (uiout, "changelist");
varobj_update_one (var);
! ui_out_list_end (uiout);
}
return MI_CMD_DONE;
}
--- 443,451 ----
if (var == NULL)
error ("mi_cmd_var_update: Variable object not found");
! ui_out_tupple_begin (uiout, "changelist");
varobj_update_one (var);
! ui_out_tupple_end (uiout);
}
return MI_CMD_DONE;
}
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.13
diff -p -r1.13 mi-main.c
*** mi-main.c 2001/05/10 20:31:46 1.13
--- mi-main.c 2001/05/11 18:07:04
*************** mi_cmd_data_list_register_names (char *c
*** 273,279 ****
numregs = NUM_REGS;
! ui_out_list_begin (uiout, "register-names");
if (argc == 0) /* No args, just do all the regs */
{
--- 273,279 ----
numregs = NUM_REGS;
! ui_out_tupple_begin (uiout, "register-names");
if (argc == 0) /* No args, just do all the regs */
{
*************** mi_cmd_data_list_register_names (char *c
*** 305,311 ****
return MI_CMD_ERROR;
}
}
! ui_out_list_end (uiout);
return MI_CMD_DONE;
}
--- 305,311 ----
return MI_CMD_ERROR;
}
}
! ui_out_tupple_end (uiout);
return MI_CMD_DONE;
}
*************** mi_cmd_data_list_changed_registers (char
*** 323,329 ****
numregs = NUM_REGS;
! ui_out_list_begin (uiout, "changed-registers");
if (argc == 0) /* No args, just do all the regs */
{
--- 323,329 ----
numregs = NUM_REGS;
! ui_out_tupple_begin (uiout, "changed-registers");
if (argc == 0) /* No args, just do all the regs */
{
*************** mi_cmd_data_list_changed_registers (char
*** 372,378 ****
return MI_CMD_ERROR;
}
}
! ui_out_list_end (uiout);
return MI_CMD_DONE;
}
--- 372,378 ----
return MI_CMD_ERROR;
}
}
! ui_out_tupple_end (uiout);
return MI_CMD_DONE;
}
*************** mi_cmd_data_list_register_values (char *
*** 433,439 ****
return MI_CMD_ERROR;
}
! ui_out_list_begin (uiout, "register-values");
if (argc == 1) /* No args, beside the format: do all the regs */
{
--- 433,439 ----
return MI_CMD_ERROR;
}
! ui_out_tupple_begin (uiout, "register-values");
if (argc == 1) /* No args, beside the format: do all the regs */
{
*************** mi_cmd_data_list_register_values (char *
*** 444,455 ****
if (REGISTER_NAME (regnum) == NULL
|| *(REGISTER_NAME (regnum)) == '\0')
continue;
! ui_out_list_begin (uiout, NULL);
ui_out_field_int (uiout, "number", regnum);
result = get_register (regnum, format);
if (result == -1)
return MI_CMD_ERROR;
! ui_out_list_end (uiout);
}
}
--- 444,455 ----
if (REGISTER_NAME (regnum) == NULL
|| *(REGISTER_NAME (regnum)) == '\0')
continue;
! ui_out_tupple_begin (uiout, NULL);
ui_out_field_int (uiout, "number", regnum);
result = get_register (regnum, format);
if (result == -1)
return MI_CMD_ERROR;
! ui_out_tupple_end (uiout);
}
}
*************** mi_cmd_data_list_register_values (char *
*** 463,474 ****
&& REGISTER_NAME (regnum) != NULL
&& *REGISTER_NAME (regnum) != '\000')
{
! ui_out_list_begin (uiout, NULL);
ui_out_field_int (uiout, "number", regnum);
result = get_register (regnum, format);
if (result == -1)
return MI_CMD_ERROR;
! ui_out_list_end (uiout);
}
else
{
--- 463,474 ----
&& REGISTER_NAME (regnum) != NULL
&& *REGISTER_NAME (regnum) != '\000')
{
! ui_out_tupple_begin (uiout, NULL);
ui_out_field_int (uiout, "number", regnum);
result = get_register (regnum, format);
if (result == -1)
return MI_CMD_ERROR;
! ui_out_tupple_end (uiout);
}
else
{
*************** mi_cmd_data_list_register_values (char *
*** 476,482 ****
return MI_CMD_ERROR;
}
}
! ui_out_list_end (uiout);
return MI_CMD_DONE;
}
--- 476,482 ----
return MI_CMD_ERROR;
}
}
! ui_out_tupple_end (uiout);
return MI_CMD_DONE;
}
*************** mi_cmd_data_read_memory (char *command,
*** 893,909 ****
struct ui_stream *stream = ui_out_stream_new (uiout);
int row;
int row_byte;
! ui_out_list_begin (uiout, "memory");
for (row = 0, row_byte = 0;
row < nr_rows;
row++, row_byte += nr_cols * word_size)
{
int col;
int col_byte;
! ui_out_list_begin (uiout, NULL);
ui_out_field_core_addr (uiout, "addr", addr + row_byte);
/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
! ui_out_list_begin (uiout, "data");
for (col = 0, col_byte = row_byte;
col < nr_cols;
col++, col_byte += word_size)
--- 893,909 ----
struct ui_stream *stream = ui_out_stream_new (uiout);
int row;
int row_byte;
! ui_out_tupple_begin (uiout, "memory");
for (row = 0, row_byte = 0;
row < nr_rows;
row++, row_byte += nr_cols * word_size)
{
int col;
int col_byte;
! ui_out_tupple_begin (uiout, NULL);
ui_out_field_core_addr (uiout, "addr", addr + row_byte);
/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
! ui_out_tupple_begin (uiout, "data");
for (col = 0, col_byte = row_byte;
col < nr_cols;
col++, col_byte += word_size)
*************** mi_cmd_data_read_memory (char *command,
*** 920,926 ****
ui_out_field_stream (uiout, NULL, stream);
}
}
! ui_out_list_end (uiout);
if (aschar)
{
int byte;
--- 920,926 ----
ui_out_field_stream (uiout, NULL, stream);
}
}
! ui_out_tupple_end (uiout);
if (aschar)
{
int byte;
*************** mi_cmd_data_read_memory (char *command,
*** 940,949 ****
}
ui_out_field_stream (uiout, "ascii", stream);
}
! ui_out_list_end (uiout);
}
ui_out_stream_delete (stream);
! ui_out_list_end (uiout);
}
do_cleanups (cleanups);
return MI_CMD_DONE;
--- 940,949 ----
}
ui_out_field_stream (uiout, "ascii", stream);
}
! ui_out_tupple_end (uiout);
}
ui_out_stream_delete (stream);
! ui_out_tupple_end (uiout);
}
do_cleanups (cleanups);
return MI_CMD_DONE;
*************** mi_load_progress (const char *section_na
*** 1377,1387 ****
if (last_async_command)
fputs_unfiltered (last_async_command, raw_stdout);
fputs_unfiltered ("+download", raw_stdout);
! ui_out_list_begin (uiout, NULL);
ui_out_field_string (uiout, "section", section_name);
ui_out_field_int (uiout, "section-size", total_section);
ui_out_field_int (uiout, "total-size", grand_total);
! ui_out_list_end (uiout);
mi_out_put (uiout, raw_stdout);
fputs_unfiltered ("\n", raw_stdout);
gdb_flush (raw_stdout);
--- 1377,1387 ----
if (last_async_command)
fputs_unfiltered (last_async_command, raw_stdout);
fputs_unfiltered ("+download", raw_stdout);
! ui_out_tupple_begin (uiout, NULL);
ui_out_field_string (uiout, "section", section_name);
ui_out_field_int (uiout, "section-size", total_section);
ui_out_field_int (uiout, "total-size", grand_total);
! ui_out_tupple_end (uiout);
mi_out_put (uiout, raw_stdout);
fputs_unfiltered ("\n", raw_stdout);
gdb_flush (raw_stdout);
*************** mi_load_progress (const char *section_na
*** 1395,1407 ****
if (last_async_command)
fputs_unfiltered (last_async_command, raw_stdout);
fputs_unfiltered ("+download", raw_stdout);
! ui_out_list_begin (uiout, NULL);
ui_out_field_string (uiout, "section", section_name);
ui_out_field_int (uiout, "section-sent", sent_so_far);
ui_out_field_int (uiout, "section-size", total_section);
ui_out_field_int (uiout, "total-sent", total_sent);
ui_out_field_int (uiout, "total-size", grand_total);
! ui_out_list_end (uiout);
mi_out_put (uiout, raw_stdout);
fputs_unfiltered ("\n", raw_stdout);
gdb_flush (raw_stdout);
--- 1395,1407 ----
if (last_async_command)
fputs_unfiltered (last_async_command, raw_stdout);
fputs_unfiltered ("+download", raw_stdout);
! ui_out_tupple_begin (uiout, NULL);
ui_out_field_string (uiout, "section", section_name);
ui_out_field_int (uiout, "section-sent", sent_so_far);
ui_out_field_int (uiout, "section-size", total_section);
ui_out_field_int (uiout, "total-sent", total_sent);
ui_out_field_int (uiout, "total-size", grand_total);
! ui_out_tupple_end (uiout);
mi_out_put (uiout, raw_stdout);
fputs_unfiltered ("\n", raw_stdout);
gdb_flush (raw_stdout);