From f99d8bf46c55bc0192b3765e7738fd644c20619e Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 27 Mar 2012 19:08:37 +0000 Subject: [PATCH] 2012-03-27 Pedro Alves Eliminate struct ui_stream. * ui-out.h (struct ui_stream): Delete. (ui_out_field_stream): Adjust prototype. (ui_out_stream_new, ui_out_stream_delete) (make_cleanup_ui_out_stream_delete): Delete declarations. * ui-out.c (ui_out_field_stream): Change prototype to take a ui_file instead of a ui_stream. Adjust. (ui_out_stream_new, ui_out_stream_delete, do_stream_delete) (make_cleanup_ui_out_stream_delete): Delete. * breakpoint.c (print_breakpoint_location) (print_one_detail_ranged_breakpoint, print_it_watchpoint): Use ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new. * disasm.c (dump_insns): Ditto. (do_mixed_source_and_assembly, do_assembly_only): Adjust prototype. (gdb_disassembly): Use ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new. * infcmd.c (print_return_value): Ditto. * osdata.c (info_osdata_command): Don't allocate a local ui_stream. * stack.c (print_frame_arg, print_frame_args, print_frame): Use ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new. * tracepoint.c (print_one_static_tracepoint_marker): Don't allocate a local ui_stream. * mi/mi-cmd-stack.c (list_arg_or_local): Use ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new. (list_args_or_locals): Don't allocate a local ui_stream. * mi/mi-main.c (get_register, mi_cmd_data_evaluate_expression) (mi_cmd_data_read_memory): Use ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new. * cli/cli-setshow.c (do_setshow_command): Ditto. --- gdb/ChangeLog | 35 +++++++++++++++++++++++++++ gdb/breakpoint.c | 28 +++++++++++----------- gdb/cli/cli-setshow.c | 28 +++++++++++----------- gdb/disasm.c | 22 ++++++++--------- gdb/infcmd.c | 10 ++++---- gdb/mi/mi-cmd-stack.c | 22 ++++++++--------- gdb/mi/mi-main.c | 55 ++++++++++++++++++++++--------------------- gdb/osdata.c | 5 +--- gdb/stack.c | 34 +++++++++++++------------- gdb/tracepoint.c | 3 --- gdb/ui-out.c | 37 +++-------------------------- gdb/ui-out.h | 19 +-------------- 12 files changed, 140 insertions(+), 158 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4f74aa66825..f4a4ffeef20 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,38 @@ +2012-03-27 Pedro Alves + + Eliminate struct ui_stream. + + * ui-out.h (struct ui_stream): Delete. + (ui_out_field_stream): Adjust prototype. + (ui_out_stream_new, ui_out_stream_delete) + (make_cleanup_ui_out_stream_delete): Delete declarations. + * ui-out.c (ui_out_field_stream): Change prototype to take a + ui_file instead of a ui_stream. Adjust. + (ui_out_stream_new, ui_out_stream_delete, do_stream_delete) + (make_cleanup_ui_out_stream_delete): Delete. + * breakpoint.c (print_breakpoint_location) + (print_one_detail_ranged_breakpoint, print_it_watchpoint): Use + ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new. + * disasm.c (dump_insns): Ditto. + (do_mixed_source_and_assembly, do_assembly_only): Adjust + prototype. + (gdb_disassembly): Use ui_file/mem_fileopen instead of + ui_stream/ui_out_stream_new. + * infcmd.c (print_return_value): Ditto. + * osdata.c (info_osdata_command): Don't allocate a local + ui_stream. + * stack.c (print_frame_arg, print_frame_args, print_frame): Use + ui_file/mem_fileopen instead of ui_stream/ui_out_stream_new. + * tracepoint.c (print_one_static_tracepoint_marker): Don't + allocate a local ui_stream. + * mi/mi-cmd-stack.c (list_arg_or_local): Use ui_file/mem_fileopen + instead of ui_stream/ui_out_stream_new. + (list_args_or_locals): Don't allocate a local ui_stream. + * mi/mi-main.c (get_register, mi_cmd_data_evaluate_expression) + (mi_cmd_data_read_memory): Use ui_file/mem_fileopen instead of + ui_stream/ui_out_stream_new. + * cli/cli-setshow.c (do_setshow_command): Ditto. + 2012-03-27 Oza Pawandeep * arm-linux-tdep.c (arm_linux_init_abi): Call diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index debf2b20122..be536bc90ef 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5277,10 +5277,10 @@ print_breakpoint_location (struct breakpoint *b, } else if (loc) { - struct ui_stream *stb = ui_out_stream_new (uiout); - struct cleanup *stb_chain = make_cleanup_ui_out_stream_delete (stb); + struct ui_file *stb = mem_fileopen (); + struct cleanup *stb_chain = make_cleanup_ui_file_delete (stb); - print_address_symbolic (loc->gdbarch, loc->address, stb->stream, + print_address_symbolic (loc->gdbarch, loc->address, stb, demangle, ""); ui_out_field_stream (uiout, "at", stb); @@ -9222,8 +9222,8 @@ print_one_detail_ranged_breakpoint (const struct breakpoint *b, { CORE_ADDR address_start, address_end; struct bp_location *bl = b->loc; - struct ui_stream *stb = ui_out_stream_new (uiout); - struct cleanup *cleanup = make_cleanup_ui_out_stream_delete (stb); + struct ui_file *stb = mem_fileopen (); + struct cleanup *cleanup = make_cleanup_ui_file_delete (stb); gdb_assert (bl); @@ -9231,7 +9231,7 @@ print_one_detail_ranged_breakpoint (const struct breakpoint *b, address_end = address_start + bl->length - 1; ui_out_text (uiout, "\taddress range: "); - fprintf_unfiltered (stb->stream, "[%s, %s]", + fprintf_unfiltered (stb, "[%s, %s]", print_core_address (bl->gdbarch, address_start), print_core_address (bl->gdbarch, address_end)); ui_out_field_stream (uiout, "addr", stb); @@ -9666,7 +9666,7 @@ print_it_watchpoint (bpstat bs) struct cleanup *old_chain; struct breakpoint *b; const struct bp_location *bl; - struct ui_stream *stb; + struct ui_file *stb; enum print_stop_action result; struct watchpoint *w; struct ui_out *uiout = current_uiout; @@ -9677,8 +9677,8 @@ print_it_watchpoint (bpstat bs) b = bs->breakpoint_at; w = (struct watchpoint *) b; - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); switch (b->type) { @@ -9692,10 +9692,10 @@ print_it_watchpoint (bpstat bs) mention (b); make_cleanup_ui_out_tuple_begin_end (uiout, "value"); ui_out_text (uiout, "\nOld value = "); - watchpoint_value_print (bs->old_val, stb->stream); + watchpoint_value_print (bs->old_val, stb); ui_out_field_stream (uiout, "old", stb); ui_out_text (uiout, "\nNew value = "); - watchpoint_value_print (w->val, stb->stream); + watchpoint_value_print (w->val, stb); ui_out_field_stream (uiout, "new", stb); ui_out_text (uiout, "\n"); /* More than one watchpoint may have been triggered. */ @@ -9710,7 +9710,7 @@ print_it_watchpoint (bpstat bs) mention (b); make_cleanup_ui_out_tuple_begin_end (uiout, "value"); ui_out_text (uiout, "\nValue = "); - watchpoint_value_print (w->val, stb->stream); + watchpoint_value_print (w->val, stb); ui_out_field_stream (uiout, "value", stb); ui_out_text (uiout, "\n"); result = PRINT_UNKNOWN; @@ -9727,7 +9727,7 @@ print_it_watchpoint (bpstat bs) mention (b); make_cleanup_ui_out_tuple_begin_end (uiout, "value"); ui_out_text (uiout, "\nOld value = "); - watchpoint_value_print (bs->old_val, stb->stream); + watchpoint_value_print (bs->old_val, stb); ui_out_field_stream (uiout, "old", stb); ui_out_text (uiout, "\nNew value = "); } @@ -9741,7 +9741,7 @@ print_it_watchpoint (bpstat bs) make_cleanup_ui_out_tuple_begin_end (uiout, "value"); ui_out_text (uiout, "\nValue = "); } - watchpoint_value_print (w->val, stb->stream); + watchpoint_value_print (w->val, stb); ui_out_field_stream (uiout, "new", stb); ui_out_text (uiout, "\n"); result = PRINT_UNKNOWN; diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 14fef7c1ec5..521ac0e0011 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -314,10 +314,10 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) else if (c->type == show_cmd) { struct cleanup *old_chain; - struct ui_stream *stb; + struct ui_file *stb; - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); /* Possibly call the pre hook. */ if (c->pre_show_hook) @@ -327,29 +327,29 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) { case var_string: if (*(char **) c->var) - fputstr_filtered (*(char **) c->var, '"', stb->stream); + fputstr_filtered (*(char **) c->var, '"', stb); break; case var_string_noescape: case var_optional_filename: case var_filename: case var_enum: if (*(char **) c->var) - fputs_filtered (*(char **) c->var, stb->stream); + fputs_filtered (*(char **) c->var, stb); break; case var_boolean: - fputs_filtered (*(int *) c->var ? "on" : "off", stb->stream); + fputs_filtered (*(int *) c->var ? "on" : "off", stb); break; case var_auto_boolean: switch (*(enum auto_boolean*) c->var) { case AUTO_BOOLEAN_TRUE: - fputs_filtered ("on", stb->stream); + fputs_filtered ("on", stb); break; case AUTO_BOOLEAN_FALSE: - fputs_filtered ("off", stb->stream); + fputs_filtered ("off", stb); break; case AUTO_BOOLEAN_AUTO: - fputs_filtered ("auto", stb->stream); + fputs_filtered ("auto", stb); break; default: internal_error (__FILE__, __LINE__, @@ -362,17 +362,17 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) case var_zuinteger: if (c->var_type == var_uinteger && *(unsigned int *) c->var == UINT_MAX) - fputs_filtered ("unlimited", stb->stream); + fputs_filtered ("unlimited", stb); else - fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var); + fprintf_filtered (stb, "%u", *(unsigned int *) c->var); break; case var_integer: case var_zinteger: if (c->var_type == var_integer && *(int *) c->var == INT_MAX) - fputs_filtered ("unlimited", stb->stream); + fputs_filtered ("unlimited", stb); else - fprintf_filtered (stb->stream, "%d", *(int *) c->var); + fprintf_filtered (stb, "%d", *(int *) c->var); break; default: @@ -389,7 +389,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) ui_out_field_stream (uiout, "value", stb); else { - char *value = ui_file_xstrdup (stb->stream, NULL); + char *value = ui_file_xstrdup (stb, NULL); make_cleanup (xfree, value); if (c->show_value_func != NULL) diff --git a/gdb/disasm.c b/gdb/disasm.c index 89bd82918cc..e3d3349200e 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -97,7 +97,7 @@ static int dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, struct disassemble_info * di, CORE_ADDR low, CORE_ADDR high, - int how_many, int flags, struct ui_stream *stb) + int how_many, int flags, struct ui_file *stb) { int num_displayed = 0; CORE_ADDR pc; @@ -145,7 +145,7 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, if (name != NULL) xfree (name); - ui_file_rewind (stb->stream); + ui_file_rewind (stb); if (flags & DISASSEMBLY_RAW_INSN) { CORE_ADDR old_pc = pc; @@ -155,9 +155,9 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, /* Build the opcodes using a temporary stream so we can write them out in a single go for the MI. */ - struct ui_stream *opcode_stream = ui_out_stream_new (uiout); + struct ui_file *opcode_stream = mem_fileopen (); struct cleanup *cleanups = - make_cleanup_ui_out_stream_delete (opcode_stream); + make_cleanup_ui_file_delete (opcode_stream); pc += gdbarch_print_insn (gdbarch, pc, di); for (;old_pc < pc; old_pc++) @@ -165,7 +165,7 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, status = (*di->read_memory_func) (old_pc, &data, 1, di); if (status != 0) (*di->memory_error_func) (status, old_pc, di); - fprintf_filtered (opcode_stream->stream, "%s%02x", + fprintf_filtered (opcode_stream, "%s%02x", spacer, (unsigned) data); spacer = " "; } @@ -177,7 +177,7 @@ dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, else pc += gdbarch_print_insn (gdbarch, pc, di); ui_out_field_stream (uiout, "inst", stb); - ui_file_rewind (stb->stream); + ui_file_rewind (stb); do_cleanups (ui_out_chain); ui_out_text (uiout, "\n"); } @@ -195,7 +195,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout, struct linetable_entry *le, CORE_ADDR low, CORE_ADDR high, struct symtab *symtab, - int how_many, int flags, struct ui_stream *stb) + int how_many, int flags, struct ui_file *stb) { int newlines = 0; struct dis_line_entry *mle; @@ -342,7 +342,7 @@ static void do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout, struct disassemble_info * di, CORE_ADDR low, CORE_ADDR high, - int how_many, int flags, struct ui_stream *stb) + int how_many, int flags, struct ui_file *stb) { int num_displayed = 0; struct cleanup *ui_out_chain; @@ -402,9 +402,9 @@ gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout, char *file_string, int flags, int how_many, CORE_ADDR low, CORE_ADDR high) { - struct ui_stream *stb = ui_out_stream_new (uiout); - struct cleanup *cleanups = make_cleanup_ui_out_stream_delete (stb); - struct disassemble_info di = gdb_disassemble_info (gdbarch, stb->stream); + struct ui_file *stb = mem_fileopen (); + struct cleanup *cleanups = make_cleanup_ui_file_delete (stb); + struct disassemble_info di = gdb_disassemble_info (gdbarch, stb); /* To collect the instruction outputted from opcodes. */ struct symtab *symtab = NULL; struct linetable_entry *le = NULL; diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 1c092dd1a88..6a841e549ac 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1471,23 +1471,23 @@ static void print_return_value (struct type *func_type, struct type *value_type) { struct value *value = get_return_value (func_type, value_type); - struct cleanup *old_chain; - struct ui_stream *stb; struct ui_out *uiout = current_uiout; if (value) { struct value_print_options opts; + struct ui_file *stb; + struct cleanup *old_chain; /* Print it. */ - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); ui_out_text (uiout, "Value returned is "); ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); ui_out_text (uiout, " = "); get_raw_print_options (&opts); - value_print (value, stb->stream, &opts); + value_print (value, stb, &opts); ui_out_field_stream (uiout, "return-value", stb); ui_out_text (uiout, "\n"); do_cleanups (old_chain); diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index efb2abe2727..f537dd6cd23 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -250,9 +250,13 @@ static void list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, enum print_values values) { + struct cleanup *old_chain; struct cleanup *cleanup_tuple = NULL; struct ui_out *uiout = current_uiout; - struct ui_stream *stb = ui_out_stream_new (uiout); + struct ui_file *stb; + + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); gdb_assert (!arg->val || !arg->error); gdb_assert ((values == PRINT_NO_VALUES && arg->val == NULL @@ -267,9 +271,9 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, if (values != PRINT_NO_VALUES || what == all) cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - fputs_filtered (SYMBOL_PRINT_NAME (arg->sym), stb->stream); + fputs_filtered (SYMBOL_PRINT_NAME (arg->sym), stb); if (arg->entry_kind == print_entry_values_only) - fputs_filtered ("@entry", stb->stream); + fputs_filtered ("@entry", stb); ui_out_field_stream (uiout, "name", stb); if (what == all && SYMBOL_IS_ARGUMENT (arg->sym)) @@ -278,7 +282,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, if (values == PRINT_SIMPLE_VALUES) { check_typedef (arg->sym->type); - type_print (arg->sym->type, "", stb->stream, -1); + type_print (arg->sym->type, "", stb, -1); ui_out_field_stream (uiout, "type", stb); } @@ -298,19 +302,19 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, get_raw_print_options (&opts); opts.deref_ref = 1; - common_val_print (arg->val, stb->stream, 0, &opts, + common_val_print (arg->val, stb, 0, &opts, language_def (SYMBOL_LANGUAGE (arg->sym))); } } if (except.message) - fprintf_filtered (stb->stream, _(""), + fprintf_filtered (stb, _(""), except.message); ui_out_field_stream (uiout, "value", stb); } - ui_out_stream_delete (stb); if (values != PRINT_NO_VALUES || what == all) do_cleanups (cleanup_tuple); + do_cleanups (old_chain); } /* Print a list of the locals or the arguments for the currently @@ -326,13 +330,10 @@ list_args_or_locals (enum what_to_list what, enum print_values values, struct symbol *sym; struct dict_iterator iter; struct cleanup *cleanup_list; - struct ui_stream *stb; struct type *type; char *name_of_result; struct ui_out *uiout = current_uiout; - stb = ui_out_stream_new (uiout); - block = get_frame_block (fi, 0); switch (what) @@ -437,7 +438,6 @@ list_args_or_locals (enum what_to_list what, enum print_values values, block = BLOCK_SUPERBLOCK (block); } do_cleanups (cleanup_list); - ui_out_stream_delete (stb); } void diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 9f14f016f9a..94e580fe27e 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1133,11 +1133,8 @@ get_register (struct frame_info *frame, int regnum, int format) struct ui_out *uiout = current_uiout; CORE_ADDR addr; enum lval_type lval; - struct ui_stream *stb; struct value *val; - stb = ui_out_stream_new (uiout); - if (format == 'N') format = 0; @@ -1167,15 +1164,20 @@ get_register (struct frame_info *frame, int regnum, int format) else { struct value_print_options opts; + struct ui_file *stb; + struct cleanup *old_chain; + + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); get_formatted_print_options (&opts, format); opts.deref_ref = 1; val_print (value_type (val), value_contents_for_printing (val), value_embedded_offset (val), 0, - stb->stream, 0, val, &opts, current_language); + stb, 0, val, &opts, current_language); ui_out_field_stream (uiout, "value", stb); - ui_out_stream_delete (stb); + do_cleanups (old_chain); } } @@ -1247,34 +1249,31 @@ void mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) { struct expression *expr; - struct cleanup *old_chain = NULL; + struct cleanup *old_chain; struct value *val; - struct ui_stream *stb = NULL; + struct ui_file *stb; struct value_print_options opts; struct ui_out *uiout = current_uiout; - stb = ui_out_stream_new (uiout); + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); if (argc != 1) - { - ui_out_stream_delete (stb); - error (_("-data-evaluate-expression: " - "Usage: -data-evaluate-expression expression")); - } + error (_("-data-evaluate-expression: " + "Usage: -data-evaluate-expression expression")); expr = parse_expression (argv[0]); - old_chain = make_cleanup (free_current_contents, &expr); + make_cleanup (free_current_contents, &expr); val = evaluate_expression (expr); /* Print the result of the expression evaluation. */ get_user_print_options (&opts); opts.deref_ref = 0; - common_val_print (val, stb->stream, 0, &opts, current_language); + common_val_print (val, stb, 0, &opts, current_language); ui_out_field_stream (uiout, "value", stb); - ui_out_stream_delete (stb); do_cleanups (old_chain); } @@ -1420,12 +1419,15 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) /* Build the result as a two dimentional table. */ { - struct ui_stream *stream = ui_out_stream_new (uiout); - struct cleanup *cleanup_list_memory; + struct ui_file *stream; + struct cleanup *cleanup_stream; int row; int row_byte; - cleanup_list_memory = make_cleanup_ui_out_list_begin_end (uiout, "memory"); + stream = mem_fileopen (); + cleanup_stream = make_cleanup_ui_file_delete (stream); + + make_cleanup_ui_out_list_begin_end (uiout, "memory"); for (row = 0, row_byte = 0; row < nr_rows; row++, row_byte += nr_cols * word_size) @@ -1452,9 +1454,9 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) } else { - ui_file_rewind (stream->stream); + ui_file_rewind (stream); print_scalar_formatted (mbuf + col_byte, word_type, &opts, - word_asize, stream->stream); + word_asize, stream); ui_out_field_stream (uiout, NULL, stream); } } @@ -1463,23 +1465,22 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc) { int byte; - ui_file_rewind (stream->stream); + ui_file_rewind (stream); for (byte = row_byte; byte < row_byte + word_size * nr_cols; byte++) { if (byte >= nr_bytes) - fputc_unfiltered ('X', stream->stream); + fputc_unfiltered ('X', stream); else if (mbuf[byte] < 32 || mbuf[byte] > 126) - fputc_unfiltered (aschar, stream->stream); + fputc_unfiltered (aschar, stream); else - fputc_unfiltered (mbuf[byte], stream->stream); + fputc_unfiltered (mbuf[byte], stream); } ui_out_field_stream (uiout, "ascii", stream); } do_cleanups (cleanup_tuple); } - ui_out_stream_delete (stream); - do_cleanups (cleanup_list_memory); + do_cleanups (cleanup_stream); } do_cleanups (cleanups); } diff --git a/gdb/osdata.c b/gdb/osdata.c index 62ce412ca68..67dbb4b536e 100644 --- a/gdb/osdata.c +++ b/gdb/osdata.c @@ -355,13 +355,10 @@ info_osdata_command (char *type, int from_tty) ix_items++) { struct cleanup *old_chain; - struct ui_stream *stb; int ix_cols; struct osdata_column *col; - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); - make_cleanup_ui_out_tuple_begin_end (uiout, "item"); + old_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "item"); for (ix_cols = 0; VEC_iterate (osdata_column_s, item->columns, diff --git a/gdb/stack.c b/gdb/stack.c index 22b16a54dcc..bbd6b7fe328 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -210,10 +210,10 @@ print_frame_arg (const struct frame_arg *arg) struct ui_out *uiout = current_uiout; volatile struct gdb_exception except; struct cleanup *old_chain; - struct ui_stream *stb; + struct ui_file *stb; - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); gdb_assert (!arg->val || !arg->error); gdb_assert (arg->entry_kind == print_entry_values_no @@ -224,21 +224,21 @@ print_frame_arg (const struct frame_arg *arg) annotate_arg_begin (); make_cleanup_ui_out_tuple_begin_end (uiout, NULL); - fprintf_symbol_filtered (stb->stream, SYMBOL_PRINT_NAME (arg->sym), + fprintf_symbol_filtered (stb, SYMBOL_PRINT_NAME (arg->sym), SYMBOL_LANGUAGE (arg->sym), DMGL_PARAMS | DMGL_ANSI); if (arg->entry_kind == print_entry_values_compact) { /* It is OK to provide invalid MI-like stream as with PRINT_ENTRY_VALUE_COMPACT we never use MI. */ - fputs_filtered ("=", stb->stream); + fputs_filtered ("=", stb); - fprintf_symbol_filtered (stb->stream, SYMBOL_PRINT_NAME (arg->sym), + fprintf_symbol_filtered (stb, SYMBOL_PRINT_NAME (arg->sym), SYMBOL_LANGUAGE (arg->sym), DMGL_PARAMS | DMGL_ANSI); } if (arg->entry_kind == print_entry_values_only || arg->entry_kind == print_entry_values_compact) - fputs_filtered ("@entry", stb->stream); + fputs_filtered ("@entry", stb); ui_out_field_stream (uiout, "name", stb); annotate_arg_name_end (); ui_out_text (uiout, "="); @@ -279,17 +279,17 @@ print_frame_arg (const struct frame_arg *arg) /* True in "summary" mode, false otherwise. */ opts.summary = !strcmp (print_frame_arguments, "scalars"); - common_val_print (arg->val, stb->stream, 2, &opts, language); + common_val_print (arg->val, stb, 2, &opts, language); } } if (except.message) - fprintf_filtered (stb->stream, _(""), + fprintf_filtered (stb, _(""), except.message); } ui_out_field_stream (uiout, "value", stb); - /* Aleo invoke ui_out_tuple_end. */ + /* Also invoke ui_out_tuple_end. */ do_cleanups (old_chain); annotate_arg_end (); @@ -500,14 +500,14 @@ print_frame_args (struct symbol *func, struct frame_info *frame, /* Number of ints of arguments that we have printed so far. */ int args_printed = 0; struct cleanup *old_chain, *list_chain; - struct ui_stream *stb; + struct ui_file *stb; /* True if we should print arguments, false otherwise. */ int print_args = strcmp (print_frame_arguments, "none"); /* True in "summary" mode, false otherwise. */ int summary = !strcmp (print_frame_arguments, "scalars"); - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); if (func) { @@ -1103,7 +1103,7 @@ print_frame (struct frame_info *frame, int print_level, struct ui_out *uiout = current_uiout; const char *funname = NULL; enum language funlang = language_unknown; - struct ui_stream *stb; + struct ui_file *stb; struct cleanup *old_chain, *list_chain; struct value_print_options opts; struct symbol *func; @@ -1112,8 +1112,8 @@ print_frame (struct frame_info *frame, int print_level, pc_p = get_frame_pc_if_available (frame, &pc); - stb = ui_out_stream_new (uiout); - old_chain = make_cleanup_ui_out_stream_delete (stb); + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); find_frame_funname (frame, &funname, &funlang, &func); @@ -1143,7 +1143,7 @@ print_frame (struct frame_info *frame, int print_level, ui_out_text (uiout, " in "); } annotate_frame_function_name (); - fprintf_symbol_filtered (stb->stream, funname ? funname : "??", + fprintf_symbol_filtered (stb, funname ? funname : "??", funlang, DMGL_ANSI); ui_out_field_stream (uiout, "func", stb); ui_out_wrap_hint (uiout, " "); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 89f75b6b7ef..057b44165f5 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -4777,8 +4777,6 @@ print_one_static_tracepoint_marker (int count, char wrap_indent[80]; char extra_field_indent[80]; struct ui_out *uiout = current_uiout; - struct ui_stream *stb = ui_out_stream_new (uiout); - struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb); struct cleanup *bkpt_chain; VEC(breakpoint_p) *tracepoints; @@ -4885,7 +4883,6 @@ print_one_static_tracepoint_marker (int count, VEC_free (breakpoint_p, tracepoints); do_cleanups (bkpt_chain); - do_cleanups (old_chain); } static void diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 9f24784db54..aa53f3ffea5 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -501,17 +501,17 @@ ui_out_field_core_addr (struct ui_out *uiout, void ui_out_field_stream (struct ui_out *uiout, const char *fldname, - struct ui_stream *buf) + struct ui_file *stream) { long length; - char *buffer = ui_file_xstrdup (buf->stream, &length); + char *buffer = ui_file_xstrdup (stream, &length); struct cleanup *old_cleanup = make_cleanup (xfree, buffer); if (length > 0) ui_out_field_string (uiout, fldname, buffer); else ui_out_field_skip (uiout, fldname); - ui_file_rewind (buf->stream); + ui_file_rewind (stream); do_cleanups (old_cleanup); } @@ -589,37 +589,6 @@ ui_out_message (struct ui_out *uiout, int verbosity, va_end (args); } -struct ui_stream * -ui_out_stream_new (struct ui_out *uiout) -{ - struct ui_stream *tempbuf; - - tempbuf = XMALLOC (struct ui_stream); - tempbuf->uiout = uiout; - tempbuf->stream = mem_fileopen (); - return tempbuf; -} - -void -ui_out_stream_delete (struct ui_stream *buf) -{ - ui_file_delete (buf->stream); - xfree (buf); -} - -static void -do_stream_delete (void *buf) -{ - ui_out_stream_delete (buf); -} - -struct cleanup * -make_cleanup_ui_out_stream_delete (struct ui_stream *buf) -{ - return make_cleanup (do_stream_delete, buf); -} - - void ui_out_wrap_hint (struct ui_out *uiout, char *identstring) { diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 9a75eed1b9a..4b9725f5129 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -52,17 +52,6 @@ enum ui_flags }; -/* The ui_out stream structure. */ -/* NOTE: cagney/2000-02-01: The ui_stream object can be subsumed by - the more generic ui_file object. */ - -struct ui_stream - { - struct ui_out *uiout; - struct ui_file *stream; - }; - - /* Prototypes for ui-out API. */ /* A result is a recursive data structure consisting of lists and @@ -122,7 +111,7 @@ extern void ui_out_field_string (struct ui_out * uiout, const char *fldname, const char *string); extern void ui_out_field_stream (struct ui_out *uiout, const char *fldname, - struct ui_stream *buf); + struct ui_file *stream); extern void ui_out_field_fmt (struct ui_out *uiout, const char *fldname, const char *format, ...) @@ -138,12 +127,6 @@ extern void ui_out_message (struct ui_out *uiout, int verbosity, const char *format, ...) ATTRIBUTE_PRINTF (3, 4); -extern struct ui_stream *ui_out_stream_new (struct ui_out *uiout); - -extern void ui_out_stream_delete (struct ui_stream *buf); - -struct cleanup *make_cleanup_ui_out_stream_delete (struct ui_stream *buf); - extern void ui_out_wrap_hint (struct ui_out *uiout, char *identstring); extern void ui_out_flush (struct ui_out *uiout); -- 2.30.2