diff options
author | Pedro Alves <palves@redhat.com> | 2012-03-27 19:08:37 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2012-03-27 19:08:37 +0000 |
commit | f99d8bf46c55bc0192b3765e7738fd644c20619e (patch) | |
tree | 2fb350823defa26f0a9bf4c46085288f4862c546 /gdb/mi | |
parent | 72508ac0bfe7aae764ddce41ea504e2377fecd1d (diff) | |
download | gdb-f99d8bf46c55bc0192b3765e7738fd644c20619e.zip gdb-f99d8bf46c55bc0192b3765e7738fd644c20619e.tar.gz gdb-f99d8bf46c55bc0192b3765e7738fd644c20619e.tar.bz2 |
2012-03-27 Pedro Alves <palves@redhat.com>
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.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 22 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 55 |
2 files changed, 39 insertions, 38 deletions
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index efb2abe..f537dd6 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, _("<error reading variable: %s>"), + fprintf_filtered (stb, _("<error reading variable: %s>"), 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 9f14f01..94e580f 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); } |