This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Rename uiout -> current_uiout


On Wednesday 03 August 2011 19:10:41, Pedro Alves wrote:
> `uiout' is not a great name for grepping for uses.  I'll post a
> followup that renames it to `current_uiout'.

I've applied this.

2011-08-04  Pedro Alves  <pedro@codesourcery.com>

	gdb/
	* ui-out.h (uiout): Rename to ...
	(current_uiout): ... this.
	* ui-out.c (uiout): Rename to ...
	(current_uiout): ... this.
	* ada-lang.c (print_it_exception, print_one_exception)
	(print_mention_exception): Adjust.
	* breakpoint.c (watchpoint_check): Adjust.
	(print_breakpoint_location, print_one_breakpoint, breakpoint_1)
	(default_collect_info, watchpoints_info, print_one_catch_fork)
	(print_one_catch_vfork, print_one_catch_syscall)
	(print_one_catch_exec, mention, print_it_ranged_breakpoint)
	(print_one_ranged_breakpoint, print_mention_ranged_breakpoint)
	(print_it_watchpoint, print_mention_watchpoint)
	(print_it_masked_watchpoint, print_mention_masked_watchpoint)
	(print_it_exception_catchpoint, print_one_exception_catchpoint)
	(print_mention_exception_catchpoint, say_where, bkpt_print_it)
	(bkpt_print_mention, momentary_bkpt_print_it)
	(tracepoint_print_mention, update_static_tracepoint)
	(tracepoints_info, save_breakpoints): Adjust.
	* cli-out.c (field_separator): Adjust.
	* cp-abi.c (list_cp_abis, show_cp_abi_cmd): Adjust.
	* exceptions.c (catch_exceptions_with_msg, catch_errors): Adjust.
	* frame.c (get_current_frame): Adjust.
	* infcmd.c (run_command_1, print_return_value): Adjust.
	* inferior.c (inferior_command, info_inferiors_command): Adjust.
	* infrun.c (print_end_stepping_range_reason): Adjust.
	(print_signal_exited_reason, print_exited_reason): Adjust.
	(print_signal_received_reason, print_no_history_reason): Adjust.
	* interps.c (interp_set): Adjust.
	* osdata.c (info_osdata_command): Adjust.
	* progspace.c (maintenance_info_program_spaces_command): Adjust.
	* remote-fileio.c (remote_fileio_request): Adjust.
	* remote.c (show_remote_cmd): Adjust.
	* solib.c (info_sharedlibrary_command): Adjust.
	* source.c (print_source_lines_base): Adjust.
	* stack.c (print_stack_frame): Adjust.
	(do_gdb_disassembly, print_frame_info, print_frame): Adjust.
	* symfile-mem.c (add_vsyscall_page): Adjust.
	* symfile.c (load_progress, generic_load)
	(print_transfer_performance): Adjust.
	* thread.c (info_threads_command, restore_selected_frame)
	(thread_command): Adjust.
	* top.c (make_cleanup_restore_ui_file): Adjust.
	* tracepoint.c (tvariables_info_1, trace_status_mi, tfind_1)
	(print_one_static_tracepoint_marker): Adjust.
	* cli/cli-cmds.c (print_disassembly): Adjust.
	* cli/cli-decode.c (print_doc_line): Adjust.
	* cli/cli-interp.c (safe_execute_command): Adjust.
	* cli/cli-logging.c (set_logging_redirect, pop_output_files)
	(handle_redirections): Adjust.
	* cli/cli-script.c (show_user_1): Adjust.
	* cli/cli-setshow.c (do_setshow_command, cmd_show_list): Adjust.
	* mi/mi-cmd-break.c (breakpoint_notify): Adjust.
	* mi/mi-cmd-disas.c (mi_cmd_disassemble): Adjust.
	* mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_path)
	(mi_cmd_env_dir): Adjust.
	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
	(print_partial_file_name, mi_cmd_file_list_exec_source_files): Adjust.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
	(mi_cmd_stack_info_depth, mi_cmd_stack_list_args)
	(list_args_or_locals): Adjust.
	* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_create)
	(mi_cmd_var_delete, mi_cmd_var_set_format, mi_cmd_var_set_frozen)
	(mi_cmd_var_show_format, mi_cmd_var_info_num_children)
	(mi_cmd_var_list_children, mi_cmd_var_info_type)
	(mi_cmd_var_info_path_expression, mi_cmd_var_info_expression)
	(mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression)
	(mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one): Adjust.
	* mi/mi-interp.c (mi_on_normal_stop): Adjust.
	* mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_thread_select)
	(mi_cmd_thread_list_ids, mi_cmd_thread_info, print_one_inferior)
	(list_available_thread_groups, mi_cmd_list_thread_groups)
	(mi_cmd_data_list_register_names)
	(mi_cmd_data_list_changed_registers)
	(mi_cmd_data_list_register_values, get_register)
	(mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory)
	(mi_cmd_data_read_memory_bytes, mi_cmd_list_features)
	(mi_cmd_list_target_features, mi_cmd_add_inferior)
	(mi_execute_command, mi_load_progress): Adjust.
	* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Adjust.
	* python/py-auto-load.c (print_script, info_auto_load_scripts):
	Adjust.
	* python/py-breakpoint.c (bppy_get_commands): Adjust.
	* tui/tui-interp.c (tui_command_loop): Adjust.
	* tui/tui-io.c (tui_setup_io, tui_initialize_io): Adjust.

---
 gdb/ada-lang.c             |    3 +++
 gdb/breakpoint.c           |   41 +++++++++++++++++++++++++++++++++++------
 gdb/cli-out.c              |    2 +-
 gdb/cli/cli-cmds.c         |    2 +-
 gdb/cli/cli-decode.c       |    2 +-
 gdb/cli/cli-interp.c       |    6 +++---
 gdb/cli/cli-logging.c      |    5 +++--
 gdb/cli/cli-script.c       |    2 +-
 gdb/cli/cli-setshow.c      |    3 +++
 gdb/cp-abi.c               |    3 +++
 gdb/exceptions.c           |   12 ++++++------
 gdb/frame.c                |    4 ++--
 gdb/infcmd.c               |    2 ++
 gdb/inferior.c             |    6 +++---
 gdb/infrun.c               |   11 ++++++++---
 gdb/interps.c              |    6 +++---
 gdb/mi/mi-cmd-break.c      |    2 +-
 gdb/mi/mi-cmd-disas.c      |    1 +
 gdb/mi/mi-cmd-env.c        |    7 ++++++-
 gdb/mi/mi-cmd-file.c       |    4 ++++
 gdb/mi/mi-cmd-stack.c      |    6 ++++--
 gdb/mi/mi-cmd-var.c        |   15 +++++++++++++++
 gdb/mi/mi-interp.c         |    8 ++++----
 gdb/mi/mi-main.c           |   37 ++++++++++++++++++++++++++-----------
 gdb/mi/mi-symbol-cmds.c    |    1 +
 gdb/osdata.c               |    1 +
 gdb/progspace.c            |    2 +-
 gdb/python/py-auto-load.c  |    2 ++
 gdb/python/py-breakpoint.c |    6 +++---
 gdb/remote-fileio.c        |    3 ++-
 gdb/remote.c               |    1 +
 gdb/solib.c                |    1 +
 gdb/source.c               |    1 +
 gdb/stack.c                |   10 +++++++---
 gdb/symfile-mem.c          |    2 +-
 gdb/symfile.c              |    4 +++-
 gdb/thread.c               |    6 +++---
 gdb/top.c                  |    4 ++--
 gdb/tracepoint.c           |    5 +++++
 gdb/tui/tui-interp.c       |    6 +++---
 gdb/tui/tui-io.c           |    8 ++++----
 gdb/ui-out.c               |    2 +-
 gdb/ui-out.h               |    2 +-
 43 files changed, 182 insertions(+), 75 deletions(-)

Index: src/gdb/ui-out.h
===================================================================
--- src.orig/gdb/ui-out.h	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/ui-out.h	2011-08-04 19:28:09.506650227 +0100
@@ -33,7 +33,7 @@ struct ui_file;
 
 /* FIXME: This should not be a global but something passed down from main.c
    or top.c.  */
-extern struct ui_out *uiout;
+extern struct ui_out *current_uiout;
 
 /* alignment enum */
 enum ui_align
Index: src/gdb/ui-out.c
===================================================================
--- src.orig/gdb/ui-out.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/ui-out.c	2011-08-04 19:28:09.506650227 +0100
@@ -222,7 +222,7 @@ struct ui_out def_uiout =
 /* FIXME: This should not be a global, but something passed down from main.c
    or top.c.  */
 
-struct ui_out *uiout = &def_uiout;
+struct ui_out *current_uiout = &def_uiout;
 
 /* These are the interfaces to implementation functions.  */
 
Index: src/gdb/ada-lang.c
===================================================================
--- src.orig/gdb/ada-lang.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/ada-lang.c	2011-08-04 19:28:09.466650227 +0100
@@ -11078,6 +11078,7 @@ check_status_exception (enum exception_c
 static enum print_stop_action
 print_it_exception (enum exception_catchpoint_kind ex, bpstat bs)
 {
+  struct ui_out *uiout = current_uiout;
   struct breakpoint *b = bs->breakpoint_at;
 
   annotate_catchpoint (b->number);
@@ -11150,6 +11151,7 @@ static void
 print_one_exception (enum exception_catchpoint_kind ex,
                      struct breakpoint *b, struct bp_location **last_loc)
 { 
+  struct ui_out *uiout = current_uiout;
   struct ada_catchpoint *c = (struct ada_catchpoint *) b;
   struct value_print_options opts;
 
@@ -11199,6 +11201,7 @@ print_mention_exception (enum exception_
                          struct breakpoint *b)
 {
   struct ada_catchpoint *c = (struct ada_catchpoint *) b;
+  struct ui_out *uiout = current_uiout;
 
   ui_out_text (uiout, b->disposition == disp_del ? _("Temporary catchpoint ")
                                                  : _("Catchpoint "));
Index: src/gdb/breakpoint.c
===================================================================
--- src.orig/gdb/breakpoint.c	2011-08-04 19:10:53.000000000 +0100
+++ src/gdb/breakpoint.c	2011-08-04 19:28:09.466650227 +0100
@@ -3685,6 +3685,8 @@ watchpoint_check (void *p)
     }
   else
     {
+      struct ui_out *uiout = current_uiout;
+
       /* This seems like the only logical thing to do because
          if we temporarily ignored the watchpoint, then when
          we reenter the block in which it is valid it contains
@@ -4498,6 +4500,7 @@ static void
 print_breakpoint_location (struct breakpoint *b,
 			   struct bp_location *loc)
 {
+  struct ui_out *uiout = current_uiout;
   struct cleanup *old_chain = save_current_program_space ();
 
   if (loc != NULL && loc->shlib_disabled)
@@ -4616,6 +4619,7 @@ print_one_breakpoint_location (struct br
   struct command_line *l;
   static char bpenables[] = "nynny";
 
+  struct ui_out *uiout = current_uiout;
   int header_of_multiple = 0;
   int part_of_multiple = (loc != NULL);
   struct value_print_options opts;
@@ -4906,6 +4910,7 @@ print_one_breakpoint (struct breakpoint
 		      int allflag)
 {
   struct cleanup *bkpt_chain;
+  struct ui_out *uiout = current_uiout;
 
   bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "bkpt");
 
@@ -5031,6 +5036,7 @@ breakpoint_1 (char *args, int allflag,
   struct value_print_options opts;
   int print_address_bits = 0;
   int print_type_col_width = 14;
+  struct ui_out *uiout = current_uiout;
 
   get_user_print_options (&opts);
 
@@ -5177,6 +5183,8 @@ breakpoint_1 (char *args, int allflag,
 static void
 default_collect_info (void)
 {
+  struct ui_out *uiout = current_uiout;
+
   /* If it has no value (which is frequently the case), say nothing; a
      message like "No default-collect." gets in user's face when it's
      not wanted.  */
@@ -5202,6 +5210,7 @@ static void
 watchpoints_info (char *args, int from_tty)
 {
   int num_printed = breakpoint_1 (args, 0, is_watchpoint);
+  struct ui_out *uiout = current_uiout;
 
   if (num_printed == 0)
     {
@@ -6165,6 +6174,7 @@ print_one_catch_fork (struct breakpoint
 {
   struct fork_catchpoint *c = (struct fork_catchpoint *) b;
   struct value_print_options opts;
+  struct ui_out *uiout = current_uiout;
 
   get_user_print_options (&opts);
 
@@ -6260,6 +6270,7 @@ print_one_catch_vfork (struct breakpoint
 {
   struct fork_catchpoint *c = (struct fork_catchpoint *) b;
   struct value_print_options opts;
+  struct ui_out *uiout = current_uiout;
 
   get_user_print_options (&opts);
   /* Field 4, the address, is omitted (which makes the columns not
@@ -6501,6 +6512,7 @@ print_one_catch_syscall (struct breakpoi
 {
   struct syscall_catchpoint *c = (struct syscall_catchpoint *) b;
   struct value_print_options opts;
+  struct ui_out *uiout = current_uiout;
 
   get_user_print_options (&opts);
   /* Field 4, the address, is omitted (which makes the columns not
@@ -6743,6 +6755,7 @@ print_one_catch_exec (struct breakpoint
 {
   struct exec_catchpoint *c = (struct exec_catchpoint *) b;
   struct value_print_options opts;
+  struct ui_out *uiout = current_uiout;
 
   get_user_print_options (&opts);
 
@@ -7027,7 +7040,7 @@ static void
 mention (struct breakpoint *b)
 {
   b->ops->print_mention (b);
-  if (ui_out_is_mi_like_p (uiout))
+  if (ui_out_is_mi_like_p (current_uiout))
     return;
   printf_filtered ("\n");
 }
@@ -8160,6 +8173,7 @@ print_it_ranged_breakpoint (bpstat bs)
 {
   struct breakpoint *b = bs->breakpoint_at;
   struct bp_location *bl = b->loc;
+  struct ui_out *uiout = current_uiout;
 
   gdb_assert (b->type == bp_hardware_breakpoint);
 
@@ -8192,6 +8206,7 @@ print_one_ranged_breakpoint (struct brea
 {
   struct bp_location *bl = b->loc;
   struct value_print_options opts;
+  struct ui_out *uiout = current_uiout;
 
   /* Ranged breakpoints have only one location.  */
   gdb_assert (bl && bl->next == NULL);
@@ -8241,6 +8256,7 @@ static void
 print_mention_ranged_breakpoint (struct breakpoint *b)
 {
   struct bp_location *bl = b->loc;
+  struct ui_out *uiout = current_uiout;
 
   gdb_assert (bl);
   gdb_assert (b->type == bp_hardware_breakpoint);
@@ -8668,6 +8684,7 @@ print_it_watchpoint (bpstat bs)
   struct ui_stream *stb;
   enum print_stop_action result;
   struct watchpoint *w;
+  struct ui_out *uiout = current_uiout;
 
   gdb_assert (bs->bp_location_at != NULL);
 
@@ -8760,6 +8777,7 @@ print_mention_watchpoint (struct breakpo
 {
   struct cleanup *ui_out_chain;
   struct watchpoint *w = (struct watchpoint *) b;
+  struct ui_out *uiout = current_uiout;
 
   switch (b->type)
     {
@@ -8874,6 +8892,7 @@ static enum print_stop_action
 print_it_masked_watchpoint (bpstat bs)
 {
   struct breakpoint *b = bs->breakpoint_at;
+  struct ui_out *uiout = current_uiout;
 
   /* Masked watchpoints have only one location.  */
   gdb_assert (b->loc && b->loc->next == NULL);
@@ -8940,6 +8959,7 @@ static void
 print_mention_masked_watchpoint (struct breakpoint *b)
 {
   struct watchpoint *w = (struct watchpoint *) b;
+  struct ui_out *uiout = current_uiout;
   struct cleanup *ui_out_chain;
 
   switch (b->type)
@@ -9720,6 +9740,7 @@ catch_exec_command_1 (char *arg, int fro
 static enum print_stop_action
 print_it_exception_catchpoint (bpstat bs)
 {
+  struct ui_out *uiout = current_uiout;
   struct breakpoint *b = bs->breakpoint_at;
   int bp_temp, bp_throw;
 
@@ -9754,6 +9775,7 @@ print_one_exception_catchpoint (struct b
 				struct bp_location **last_loc)
 {
   struct value_print_options opts;
+  struct ui_out *uiout = current_uiout;
 
   get_user_print_options (&opts);
   if (opts.addressprint)
@@ -9777,6 +9799,7 @@ print_one_exception_catchpoint (struct b
 static void
 print_mention_exception_catchpoint (struct breakpoint *b)
 {
+  struct ui_out *uiout = current_uiout;
   int bp_temp;
   int bp_throw;
 
@@ -10650,6 +10673,7 @@ bpstat_remove_breakpoint_callback (struc
 static void
 say_where (struct breakpoint *b)
 {
+  struct ui_out *uiout = current_uiout;
   struct value_print_options opts;
 
   get_user_print_options (&opts);
@@ -10888,6 +10912,7 @@ bkpt_print_it (bpstat bs)
   struct breakpoint *b;
   const struct bp_location *bl;
   int bp_temp;
+  struct ui_out *uiout = current_uiout;
 
   gdb_assert (bs->bp_location_at != NULL);
 
@@ -10919,7 +10944,7 @@ bkpt_print_it (bpstat bs)
 static void
 bkpt_print_mention (struct breakpoint *b)
 {
-  if (ui_out_is_mi_like_p (uiout))
+  if (ui_out_is_mi_like_p (current_uiout))
     return;
 
   switch (b->type)
@@ -11069,6 +11094,8 @@ momentary_bkpt_check_status (bpstat bs)
 static enum print_stop_action
 momentary_bkpt_print_it (bpstat bs)
 {
+  struct ui_out *uiout = current_uiout;
+
   if (ui_out_is_mi_like_p (uiout))
     {
       struct breakpoint *b = bs->breakpoint_at;
@@ -11134,7 +11161,7 @@ tracepoint_print_one_detail (const struc
 static void
 tracepoint_print_mention (struct breakpoint *b)
 {
-  if (ui_out_is_mi_like_p (uiout))
+  if (ui_out_is_mi_like_p (current_uiout))
     return;
 
   switch (b->type)
@@ -11500,6 +11527,7 @@ update_static_tracepoint (struct breakpo
 	  struct symtab_and_line sal;
 	  struct symbol *sym;
 	  struct static_tracepoint_marker *marker;
+	  struct ui_out *uiout = current_uiout;
 
 	  marker = VEC_index (static_tracepoint_marker_p, markers, 0);
 
@@ -12765,6 +12793,7 @@ create_tracepoint_from_upload (struct up
 static void
 tracepoints_info (char *args, int from_tty)
 {
+  struct ui_out *uiout = current_uiout;
   int num_printed;
 
   num_printed = breakpoint_1 (args, 0, is_tracepoint);
@@ -13079,12 +13108,12 @@ save_breakpoints (char *filename, int fr
 
 	fprintf_unfiltered (fp, "  commands\n");
 	
-	ui_out_redirect (uiout, fp);
+	ui_out_redirect (current_uiout, fp);
 	TRY_CATCH (ex, RETURN_MASK_ALL)
 	  {
-	    print_command_lines (uiout, tp->commands->commands, 2);
+	    print_command_lines (current_uiout, tp->commands->commands, 2);
 	  }
-	ui_out_redirect (uiout, NULL);
+	ui_out_redirect (current_uiout, NULL);
 
 	if (ex.reason < 0)
 	  throw_exception (ex);
Index: src/gdb/cli-out.c
===================================================================
--- src.orig/gdb/cli-out.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/cli-out.c	2011-08-04 19:28:09.466650227 +0100
@@ -342,7 +342,7 @@ out_field_fmt (struct ui_out *uiout, int
 static void
 field_separator (void)
 {
-  cli_out_data *data = ui_out_data (uiout);
+  cli_out_data *data = ui_out_data (current_uiout);
   struct ui_file *stream = VEC_last (ui_filep, data->streams);
 
   fputc_filtered (' ', stream);
Index: src/gdb/cli/cli-cmds.c
===================================================================
--- src.orig/gdb/cli/cli-cmds.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/cli/cli-cmds.c	2011-08-04 19:28:09.466650227 +0100
@@ -1063,7 +1063,7 @@ print_disassembly (struct gdbarch *gdbar
 			 paddress (gdbarch, low), paddress (gdbarch, high));
 
       /* Dump the specified range.  */
-      gdb_disassembly (gdbarch, uiout, 0, flags, -1, low, high);
+      gdb_disassembly (gdbarch, current_uiout, 0, flags, -1, low, high);
 
       printf_filtered ("End of assembler dump.\n");
       gdb_flush (gdb_stdout);
Index: src/gdb/cli/cli-decode.c
===================================================================
--- src.orig/gdb/cli/cli-decode.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/cli/cli-decode.c	2011-08-04 19:28:09.466650227 +0100
@@ -1018,7 +1018,7 @@ print_doc_line (struct ui_file *stream,
   line_buffer[p - str] = '\0';
   if (islower (line_buffer[0]))
     line_buffer[0] = toupper (line_buffer[0]);
-  ui_out_text (uiout, line_buffer);
+  ui_out_text (current_uiout, line_buffer);
 }
 
 /* Print one-line help for command C.
Index: src/gdb/cli/cli-interp.c
===================================================================
--- src.orig/gdb/cli/cli-interp.c	2011-08-04 19:18:17.000000000 +0100
+++ src/gdb/cli/cli-interp.c	2011-08-04 19:29:01.786650235 +0100
@@ -118,8 +118,8 @@ safe_execute_command (struct ui_out *com
   struct ui_out *saved_uiout;
 
   /* Save and override the global ``struct ui_out'' builder.  */
-  saved_uiout = uiout;
-  uiout = command_uiout;
+  saved_uiout = current_uiout;
+  current_uiout = command_uiout;
 
   TRY_CATCH (e, RETURN_MASK_ALL)
     {
@@ -127,7 +127,7 @@ safe_execute_command (struct ui_out *com
     }
 
   /* Restore the global builder.  */
-  uiout = saved_uiout;
+  current_uiout = saved_uiout;
 
   /* FIXME: cagney/2005-01-13: This shouldn't be needed.  Instead the
      caller should print the exception.  */
Index: src/gdb/cli/cli-logging.c
===================================================================
--- src.orig/gdb/cli/cli-logging.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/cli/cli-logging.c	2011-08-04 19:28:09.466650227 +0100
@@ -81,6 +81,7 @@ set_logging_redirect (char *args, int fr
 {
   struct cleanup *cleanups = NULL;
   struct ui_file *output, *new_logging_no_redirect_file;
+  struct ui_out *uiout = current_uiout;
 
   if (saved_filename == NULL
       || (logging_redirect != 0 && logging_no_redirect_file == NULL)
@@ -166,7 +167,7 @@ pop_output_files (void)
   saved_output.targ = NULL;
   saved_output.targerr = NULL;
 
-  ui_out_redirect (uiout, NULL);
+  ui_out_redirect (current_uiout, NULL);
 }
 
 /* This is a helper for the `set logging' command.  */
@@ -226,7 +227,7 @@ handle_redirections (int from_tty)
   gdb_stdtarg = output;
   gdb_stdtargerr = output;
 
-  if (ui_out_redirect (uiout, output) < 0)
+  if (ui_out_redirect (current_uiout, output) < 0)
     warning (_("Current output protocol does not support redirection"));
 }
 
Index: src/gdb/cli/cli-script.c
===================================================================
--- src.orig/gdb/cli/cli-script.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/cli/cli-script.c	2011-08-04 19:28:09.476650227 +0100
@@ -1661,7 +1661,7 @@ show_user_1 (struct cmd_list_element *c,
     return;
   fprintf_filtered (stream, "User command \"%s%s\":\n", prefix, name);
 
-  print_command_lines (uiout, cmdlines, 1);
+  print_command_lines (current_uiout, cmdlines, 1);
   fputs_filtered ("\n", stream);
 }
 
Index: src/gdb/cli/cli-setshow.c
===================================================================
--- src.orig/gdb/cli/cli-setshow.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/cli/cli-setshow.c	2011-08-04 19:28:09.476650227 +0100
@@ -125,6 +125,8 @@ deprecated_show_value_hack (struct ui_fi
 void
 do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
 {
+  struct ui_out *uiout = current_uiout;
+
   if (c->type == set_cmd)
     {
       switch (c->var_type)
@@ -411,6 +413,7 @@ void
 cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
 {
   struct cleanup *showlist_chain;
+  struct ui_out *uiout = current_uiout;
 
   showlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist");
   for (; list != NULL; list = list->next)
Index: src/gdb/cp-abi.c
===================================================================
--- src.orig/gdb/cp-abi.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/cp-abi.c	2011-08-04 19:28:09.476650227 +0100
@@ -262,6 +262,7 @@ find_cp_abi (const char *short_name)
 static void
 list_cp_abis (int from_tty)
 {
+  struct ui_out *uiout = current_uiout;
   struct cleanup *cleanup_chain;
   int i;
 
@@ -309,6 +310,8 @@ set_cp_abi_cmd (char *args, int from_tty
 static void
 show_cp_abi_cmd (char *args, int from_tty)
 {
+  struct ui_out *uiout = current_uiout;
+
   ui_out_text (uiout, "The currently selected C++ ABI is \"");
 
   ui_out_field_string (uiout, "cp-abi", current_cp_abi.shortname);
Index: src/gdb/exceptions.c
===================================================================
--- src.orig/gdb/exceptions.c	2011-08-04 19:13:28.000000000 +0100
+++ src/gdb/exceptions.c	2011-08-04 19:28:09.476650227 +0100
@@ -462,16 +462,16 @@ catch_exceptions_with_msg (struct ui_out
   struct ui_out *saved_uiout;
 
   /* Save and override the global ``struct ui_out'' builder.  */
-  saved_uiout = uiout;
-  uiout = func_uiout;
+  saved_uiout = current_uiout;
+  current_uiout = func_uiout;
 
   TRY_CATCH (exception, RETURN_MASK_ALL)
     {
-      val = (*func) (uiout, func_args);
+      val = (*func) (current_uiout, func_args);
     }
 
   /* Restore the global builder.  */
-  uiout = saved_uiout;
+  current_uiout = saved_uiout;
 
   if (exception.reason < 0 && (mask & RETURN_MASK (exception.reason)) == 0)
     {
@@ -511,7 +511,7 @@ catch_errors (catch_errors_ftype *func,
   struct ui_out *saved_uiout;
 
   /* Save the global ``struct ui_out'' builder.  */
-  saved_uiout = uiout;
+  saved_uiout = current_uiout;
 
   TRY_CATCH (exception, RETURN_MASK_ALL)
     {
@@ -519,7 +519,7 @@ catch_errors (catch_errors_ftype *func,
     }
 
   /* Restore the global builder.  */
-  uiout = saved_uiout;
+  current_uiout = saved_uiout;
 
   if (exception.reason < 0 && (mask & RETURN_MASK (exception.reason)) == 0)
     {
Index: src/gdb/frame.c
===================================================================
--- src.orig/gdb/frame.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/frame.c	2011-08-04 19:28:09.476650227 +0100
@@ -1306,8 +1306,8 @@ get_current_frame (void)
     {
       struct frame_info *sentinel_frame =
 	create_sentinel_frame (current_program_space, get_current_regcache ());
-      if (catch_exceptions (uiout, unwind_to_current_frame, sentinel_frame,
-			    RETURN_MASK_ERROR) != 0)
+      if (catch_exceptions (current_uiout, unwind_to_current_frame,
+			    sentinel_frame, RETURN_MASK_ERROR) != 0)
 	{
 	  /* Oops! Fake a current frame?  Is this useful?  It has a PC
              of zero, for instance.  */
Index: src/gdb/infcmd.c
===================================================================
--- src.orig/gdb/infcmd.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/infcmd.c	2011-08-04 19:28:09.476650227 +0100
@@ -503,6 +503,7 @@ run_command_1 (char *args, int from_tty,
   char *exec_file;
   struct cleanup *old_chain;
   ptid_t ptid;
+  struct ui_out *uiout = current_uiout;
 
   dont_repeat ();
 
@@ -1421,6 +1422,7 @@ print_return_value (struct type *func_ty
   struct cleanup *old_chain;
   struct ui_stream *stb;
   struct value *value;
+  struct ui_out *uiout = current_uiout;
 
   CHECK_TYPEDEF (value_type);
   gdb_assert (TYPE_CODE (value_type) != TYPE_CODE_VOID);
Index: src/gdb/inferior.c
===================================================================
--- src.orig/gdb/inferior.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/inferior.c	2011-08-04 19:28:09.476650227 +0100
@@ -732,10 +732,10 @@ inferior_command (char *args, int from_t
     }
 
   if (inf->pid != 0 && is_running (inferior_ptid))
-    ui_out_text (uiout, "(running)\n");
+    ui_out_text (current_uiout, "(running)\n");
   else if (inf->pid != 0)
     {
-      ui_out_text (uiout, "\n");
+      ui_out_text (current_uiout, "\n");
       print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
     }
 }
@@ -745,7 +745,7 @@ inferior_command (char *args, int from_t
 static void
 info_inferiors_command (char *args, int from_tty)
 {
-  print_inferior (uiout, args);
+  print_inferior (current_uiout, args);
 }
 
 /* remove-inferior ID */
Index: src/gdb/infrun.c
===================================================================
--- src.orig/gdb/infrun.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/infrun.c	2011-08-04 19:28:09.476650227 +0100
@@ -5614,8 +5614,8 @@ print_end_stepping_range_reason (void)
 {
   if ((!inferior_thread ()->step_multi
        || !inferior_thread ()->control.stop_step)
-      && ui_out_is_mi_like_p (uiout))
-    ui_out_field_string (uiout, "reason",
+      && ui_out_is_mi_like_p (current_uiout))
+    ui_out_field_string (current_uiout, "reason",
                          async_reason_lookup (EXEC_ASYNC_END_STEPPING_RANGE));
 }
 
@@ -5624,6 +5624,8 @@ print_end_stepping_range_reason (void)
 static void
 print_signal_exited_reason (enum target_signal siggnal)
 {
+  struct ui_out *uiout = current_uiout;
+
   annotate_signalled ();
   if (ui_out_is_mi_like_p (uiout))
     ui_out_field_string
@@ -5649,6 +5651,7 @@ print_exited_reason (int exitstatus)
 {
   struct inferior *inf = current_inferior ();
   const char *pidstr = target_pid_to_str (pid_to_ptid (inf->pid));
+  struct ui_out *uiout = current_uiout;
 
   annotate_exited (exitstatus);
   if (exitstatus)
@@ -5685,6 +5688,8 @@ print_exited_reason (int exitstatus)
 static void
 print_signal_received_reason (enum target_signal siggnal)
 {
+  struct ui_out *uiout = current_uiout;
+
   annotate_signal ();
 
   if (siggnal == TARGET_SIGNAL_0 && !ui_out_is_mi_like_p (uiout))
@@ -5722,7 +5727,7 @@ print_signal_received_reason (enum targe
 static void
 print_no_history_reason (void)
 {
-  ui_out_text (uiout, "\nNo more reverse-execution history.\n");
+  ui_out_text (current_uiout, "\nNo more reverse-execution history.\n");
 }
 
 /* Here to return control to GDB when the inferior stops for real.
Index: src/gdb/interps.c
===================================================================
--- src.orig/gdb/interps.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/interps.c	2011-08-04 19:28:09.476650227 +0100
@@ -150,7 +150,7 @@ interp_set (struct interp *interp, int t
 
   if (current_interpreter != NULL)
     {
-      ui_out_flush (uiout);
+      ui_out_flush (current_uiout);
       if (current_interpreter->procs->suspend_proc
 	  && !current_interpreter->procs->suspend_proc (current_interpreter->
 							data))
@@ -178,7 +178,7 @@ interp_set (struct interp *interp, int t
       interpreter_p = xstrdup (current_interpreter->name);
     }
 
-  uiout = interp->interpreter_out;
+  current_uiout = interp->interpreter_out;
 
   /* Run the init proc.  If it fails, try to restore the old interp.  */
 
@@ -214,7 +214,7 @@ interp_set (struct interp *interp, int t
 	{
 	  sprintf (buffer, "Switching to interpreter \"%.24s\".\n",
 		   interp->name);
-	  ui_out_text (uiout, buffer);
+	  ui_out_text (current_uiout, buffer);
 	}
       display_gdb_prompt (NULL);
     }
Index: src/gdb/mi/mi-cmd-break.c
===================================================================
--- src.orig/gdb/mi/mi-cmd-break.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-cmd-break.c	2011-08-04 19:28:09.486650227 +0100
@@ -50,7 +50,7 @@ static void
 breakpoint_notify (struct breakpoint *b)
 {
   if (mi_can_breakpoint_notify)
-    gdb_breakpoint_query (uiout, b->number, NULL);
+    gdb_breakpoint_query (current_uiout, b->number, NULL);
 }
 
 enum bp_type
Index: src/gdb/mi/mi-cmd-disas.c
===================================================================
--- src.orig/gdb/mi/mi-cmd-disas.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-cmd-disas.c	2011-08-04 19:28:09.486650227 +0100
@@ -55,6 +55,7 @@ void
 mi_cmd_disassemble (char *command, char **argv, int argc)
 {
   struct gdbarch *gdbarch = get_current_arch ();
+  struct ui_out *uiout = current_uiout;
   CORE_ADDR start;
 
   int mode, disasm_flags;
Index: src/gdb/mi/mi-cmd-env.c
===================================================================
--- src.orig/gdb/mi/mi-cmd-env.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-cmd-env.c	2011-08-04 19:28:09.486650227 +0100
@@ -69,6 +69,8 @@ env_execute_cli_command (const char *cmd
 void
 mi_cmd_env_pwd (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
+
   if (argc > 0)
     error (_("-environment-pwd: No arguments required"));
           
@@ -112,6 +114,7 @@ env_mod_path (char *dirname, char **whic
 void
 mi_cmd_env_path (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   char *exec_path;
   char *env;
   int reset = 0;
@@ -185,6 +188,7 @@ mi_cmd_env_path (char *command, char **a
 void
 mi_cmd_env_dir (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   int i;
   int optind = 0;
   int reset = 0;
@@ -257,7 +261,8 @@ mi_cmd_inferior_tty_show (char *command,
     error (_("-inferior-tty-show: Usage: No args"));
 
   if (inferior_io_terminal)
-    ui_out_field_string (uiout, "inferior_tty_terminal", inferior_io_terminal);
+    ui_out_field_string (current_uiout,
+			 "inferior_tty_terminal", inferior_io_terminal);
 }
 
 void 
Index: src/gdb/mi/mi-cmd-file.c
===================================================================
--- src.orig/gdb/mi/mi-cmd-file.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-cmd-file.c	2011-08-04 19:28:09.486650227 +0100
@@ -34,6 +34,7 @@ void
 mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
 {
   struct symtab_and_line st;
+  struct ui_out *uiout = current_uiout;
   
   if (!mi_valid_noargs ("-file-list-exec-source-file", argc, argv))
     error (_("-file-list-exec-source-file: Usage: No args"));
@@ -67,6 +68,8 @@ static void
 print_partial_file_name (const char *filename, const char *fullname,
 			 void *ignore)
 {
+  struct ui_out *uiout = current_uiout;
+
   ui_out_begin (uiout, ui_out_type_tuple, NULL);
 
   ui_out_field_string (uiout, "file", filename);
@@ -80,6 +83,7 @@ print_partial_file_name (const char *fil
 void
 mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct symtab *s;
   struct objfile *objfile;
 
Index: src/gdb/mi/mi-cmd-stack.c
===================================================================
--- src.orig/gdb/mi/mi-cmd-stack.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-cmd-stack.c	2011-08-04 19:28:09.486650227 +0100
@@ -78,7 +78,7 @@ mi_cmd_stack_list_frames (char *command,
   if (fi == NULL)
     error (_("-stack-list-frames: Not enough frames in stack."));
 
-  cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "stack");
+  cleanup_stack = make_cleanup_ui_out_list_begin_end (current_uiout, "stack");
 
   /* Now let;s print the frames up to frame_high, or until there are
      frames in the stack. */
@@ -117,7 +117,7 @@ mi_cmd_stack_info_depth (char *command,
        i++, fi = get_prev_frame (fi))
     QUIT;
 
-  ui_out_field_int (uiout, "depth", i);
+  ui_out_field_int (current_uiout, "depth", i);
 }
 
 static enum print_values
@@ -166,6 +166,7 @@ mi_cmd_stack_list_args (char *command, c
   struct frame_info *fi;
   struct cleanup *cleanup_stack_args;
   enum print_values print_values;
+  struct ui_out *uiout = current_uiout;
 
   if (argc < 1 || argc > 3 || argc == 2)
     error (_("-stack-list-arguments: Usage: "
@@ -249,6 +250,7 @@ list_args_or_locals (enum what_to_list w
   static struct ui_stream *stb = NULL;
   struct type *type;
   char *name_of_result;
+  struct ui_out *uiout = current_uiout;
 
   stb = ui_out_stream_new (uiout);
 
Index: src/gdb/mi/mi-cmd-var.c
===================================================================
--- src.orig/gdb/mi/mi-cmd-var.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-cmd-var.c	2011-08-04 19:28:09.486650227 +0100
@@ -51,6 +51,7 @@ static void
 print_varobj (struct varobj *var, enum print_values print_values,
 	      int print_expression)
 {
+  struct ui_out *uiout = current_uiout;
   char *type;
   int thread_id;
   char *display_hint;
@@ -98,6 +99,7 @@ print_varobj (struct varobj *var, enum p
 void
 mi_cmd_var_create (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   CORE_ADDR frameaddr = 0;
   struct varobj *var;
   char *name;
@@ -167,6 +169,7 @@ mi_cmd_var_delete (char *command, char *
   int numdel;
   int children_only_p = 0;
   struct cleanup *old_cleanups;
+  struct ui_out *uiout = current_uiout;
 
   if (argc < 1 || argc > 2)
     error (_("-var-delete: Usage: [-c] EXPRESSION."));
@@ -244,6 +247,7 @@ mi_cmd_var_set_format (char *command, ch
   enum varobj_display_formats format;
   struct varobj *var;
   char *val;
+  struct ui_out *uiout = current_uiout;
 
   if (argc != 2)
     error (_("-var-set-format: Usage: NAME FORMAT."));
@@ -310,6 +314,7 @@ mi_cmd_var_set_frozen (char *command, ch
 void
 mi_cmd_var_show_format (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   enum varobj_display_formats format;
   struct varobj *var;
 
@@ -328,6 +333,7 @@ mi_cmd_var_show_format (char *command, c
 void
 mi_cmd_var_info_num_children (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct varobj *var;
 
   if (argc != 1)
@@ -394,6 +400,7 @@ mi_print_value_p (struct varobj *var, en
 void
 mi_cmd_var_list_children (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct varobj *var;  
   VEC(varobj_p) *children;
   struct varobj *child;
@@ -466,6 +473,7 @@ mi_cmd_var_list_children (char *command,
 void
 mi_cmd_var_info_type (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct varobj *var;
 
   if (argc != 1)
@@ -480,6 +488,7 @@ mi_cmd_var_info_type (char *command, cha
 void
 mi_cmd_var_info_path_expression (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct varobj *var;
   char *path_expr;
 
@@ -497,6 +506,7 @@ mi_cmd_var_info_path_expression (char *c
 void
 mi_cmd_var_info_expression (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   enum varobj_languages lang;
   struct varobj *var;
 
@@ -515,6 +525,7 @@ mi_cmd_var_info_expression (char *comman
 void
 mi_cmd_var_show_attributes (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   int attr;
   char *attstr;
   struct varobj *var;
@@ -538,6 +549,7 @@ mi_cmd_var_show_attributes (char *comman
 void
 mi_cmd_var_evaluate_expression (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct varobj *var;
 
   enum varobj_display_formats format;
@@ -606,6 +618,7 @@ mi_cmd_var_evaluate_expression (char *co
 void
 mi_cmd_var_assign (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct varobj *var;
   char *expression, *val;
 
@@ -667,6 +680,7 @@ mi_cmd_var_update_iter (struct varobj *v
 void
 mi_cmd_var_update (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct cleanup *cleanup;
   char *name;
   enum print_values print_values;
@@ -722,6 +736,7 @@ static void
 varobj_update_one (struct varobj *var, enum print_values print_values,
 		   int explicit)
 {
+  struct ui_out *uiout = current_uiout;
   struct cleanup *cleanup = NULL;
   VEC (varobj_update_result) *changes;
   varobj_update_result *r;
Index: src/gdb/mi/mi-interp.c
===================================================================
--- src.orig/gdb/mi/mi-interp.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-interp.c	2011-08-04 19:28:09.486650227 +0100
@@ -401,18 +401,18 @@ mi_on_normal_stop (struct bpstats *bs, i
     {
       int core;
 
-      if (uiout != mi_uiout)
+      if (current_uiout != mi_uiout)
 	{
 	  /* The normal_stop function has printed frame information into 
 	     CLI uiout, or some other non-MI uiout.  There's no way we
 	     can extract proper fields from random uiout object, so we print
 	     the frame again.  In practice, this can only happen when running
 	     a CLI command in MI.  */
-	  struct ui_out *saved_uiout = uiout;
+	  struct ui_out *saved_uiout = current_uiout;
 
-	  uiout = mi_uiout;
+	  current_uiout = mi_uiout;
 	  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
-	  uiout = saved_uiout;
+	  current_uiout = saved_uiout;
 	}
 
       ui_out_field_int (mi_uiout, "thread-id",
Index: src/gdb/mi/mi-main.c
===================================================================
--- src.orig/gdb/mi/mi-main.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-main.c	2011-08-04 19:28:09.486650227 +0100
@@ -117,7 +117,7 @@ mi_cmd_gdb_exit (char *command, char **a
   if (current_token)
     fputs_unfiltered (current_token, raw_stdout);
   fputs_unfiltered ("^exit\n", raw_stdout);
-  mi_out_put (uiout, raw_stdout);
+  mi_out_put (current_uiout, raw_stdout);
   gdb_flush (raw_stdout);
   /* FIXME: The function called is not yet a formal libgdb function.  */
   quit_force (NULL, FROM_TTY);
@@ -470,7 +470,7 @@ mi_cmd_thread_select (char *command, cha
   if (argc != 1)
     error (_("-thread-select: USAGE: threadnum."));
 
-  rc = gdb_thread_select (uiout, argv[0], &mi_error_message);
+  rc = gdb_thread_select (current_uiout, argv[0], &mi_error_message);
 
   if (rc == GDB_RC_FAIL)
     {
@@ -488,7 +488,7 @@ mi_cmd_thread_list_ids (char *command, c
   if (argc != 0)
     error (_("-thread-list-ids: No arguments required."));
 
-  rc = gdb_list_thread_ids (uiout, &mi_error_message);
+  rc = gdb_list_thread_ids (current_uiout, &mi_error_message);
 
   if (rc == GDB_RC_FAIL)
     {
@@ -503,7 +503,7 @@ mi_cmd_thread_info (char *command, char
   if (argc != 0 && argc != 1)
     error (_("Invalid MI command"));
 
-  print_thread_info (uiout, argv[0], -1);
+  print_thread_info (current_uiout, argv[0], -1);
 }
 
 struct collect_cores_data
@@ -550,6 +550,7 @@ static int
 print_one_inferior (struct inferior *inferior, void *xdata)
 {
   struct print_one_inferior_data *top_data = xdata;
+  struct ui_out *uiout = current_uiout;
 
   if (VEC_empty (int, top_data->inferiors)
       || bsearch (&(inferior->pid), VEC_address (int, top_data->inferiors),
@@ -670,6 +671,7 @@ list_available_thread_groups (VEC (int)
   struct osdata *data;
   struct osdata_item *item;
   int ix_items;
+  struct ui_out *uiout = current_uiout;
 
   /* This keeps a map from integer (pid) to VEC (struct osdata_item *)*
      The vector contains information about all threads for the given pid.
@@ -787,6 +789,7 @@ list_available_thread_groups (VEC (int)
 void
 mi_cmd_list_thread_groups (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct cleanup *back_to;
   int available = 0;
   int recurse = 0;
@@ -889,6 +892,7 @@ void
 mi_cmd_data_list_register_names (char *command, char **argv, int argc)
 {
   struct gdbarch *gdbarch;
+  struct ui_out *uiout = current_uiout;
   int regnum, numregs;
   int i;
   struct cleanup *cleanup;
@@ -940,6 +944,7 @@ void
 mi_cmd_data_list_changed_registers (char *command, char **argv, int argc)
 {
   static struct regcache *this_regs = NULL;
+  struct ui_out *uiout = current_uiout;
   struct regcache *prev_regs;
   struct gdbarch *gdbarch;
   int regnum, numregs, changed;
@@ -1044,6 +1049,7 @@ register_changed_p (int regnum, struct r
 void
 mi_cmd_data_list_register_values (char *command, char **argv, int argc)
 {
+  struct ui_out *uiout = current_uiout;
   struct frame_info *frame;
   struct gdbarch *gdbarch;
   int regnum, numregs, format;
@@ -1110,6 +1116,7 @@ static void
 get_register (struct frame_info *frame, int regnum, int format)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
+  struct ui_out *uiout = current_uiout;
   CORE_ADDR addr;
   enum lval_type lval;
   static struct ui_stream *stb = NULL;
@@ -1229,6 +1236,7 @@ mi_cmd_data_evaluate_expression (char *c
   struct value *val;
   struct ui_stream *stb = NULL;
   struct value_print_options opts;
+  struct ui_out *uiout = current_uiout;
 
   stb = ui_out_stream_new (uiout);
 
@@ -1279,6 +1287,7 @@ void
 mi_cmd_data_read_memory (char *command, char **argv, int argc)
 {
   struct gdbarch *gdbarch = get_current_arch ();
+  struct ui_out *uiout = current_uiout;
   struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
   CORE_ADDR addr;
   long total_bytes;
@@ -1470,6 +1479,7 @@ void
 mi_cmd_data_read_memory_bytes (char *command, char **argv, int argc)
 {
   struct gdbarch *gdbarch = get_current_arch ();
+  struct ui_out *uiout = current_uiout;
   struct cleanup *cleanups;
   CORE_ADDR addr;
   LONGEST length;
@@ -1702,6 +1712,7 @@ mi_cmd_list_features (char *command, cha
   if (argc == 0)
     {
       struct cleanup *cleanup = NULL;
+      struct ui_out *uiout = current_uiout;
 
       cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");      
       ui_out_field_string (uiout, NULL, "frozen-varobjs");
@@ -1727,6 +1738,7 @@ mi_cmd_list_target_features (char *comma
   if (argc == 0)
     {
       struct cleanup *cleanup = NULL;
+      struct ui_out *uiout = current_uiout;
 
       cleanup = make_cleanup_ui_out_list_begin_end (uiout, "features");      
       if (target_can_async_p ())
@@ -1751,7 +1763,7 @@ mi_cmd_add_inferior (char *command, char
 
   inf = add_inferior_with_spaces ();
 
-  ui_out_field_fmt (uiout, "inferior", "i%d", inf->num);
+  ui_out_field_fmt (current_uiout, "inferior", "i%d", inf->num);
 }
 
 /* Callback used to find the first inferior other than the
@@ -1958,14 +1970,14 @@ mi_execute_command (char *cmd, int from_
 
       TRY_CATCH (result, RETURN_MASK_ALL)
 	{
-	  captured_mi_execute_command (uiout, command);
+	  captured_mi_execute_command (current_uiout, command);
 	}
       if (result.reason < 0)
 	{
 	  /* The command execution failed and error() was called
 	     somewhere.  */
 	  mi_print_exception (command->token, result);
-	  mi_out_rewind (uiout);
+	  mi_out_rewind (current_uiout);
 	}
 
       bpstat_do_actions ();
@@ -2177,22 +2189,25 @@ mi_load_progress (const char *section_na
   static char *previous_sect_name = NULL;
   int new_section;
   struct ui_out *saved_uiout;
+  struct ui_out *uiout;
 
   /* This function is called through deprecated_show_load_progress
      which means uiout may not be correct.  Fix it for the duration
      of this function.  */
-  saved_uiout = uiout;
+  saved_uiout = current_uiout;
 
   if (current_interp_named_p (INTERP_MI)
       || current_interp_named_p (INTERP_MI2))
-    uiout = mi_out_new (2);
+    current_uiout = mi_out_new (2);
   else if (current_interp_named_p (INTERP_MI1))
-    uiout = mi_out_new (1);
+    current_uiout = mi_out_new (1);
   else if (current_interp_named_p (INTERP_MI3))
-    uiout = mi_out_new (3);
+    current_uiout = mi_out_new (3);
   else
     return;
 
+  uiout = current_uiout;
+
   update_threshold.tv_sec = 0;
   update_threshold.tv_usec = 500000;
   gettimeofday (&time_now, NULL);
Index: src/gdb/mi/mi-symbol-cmds.c
===================================================================
--- src.orig/gdb/mi/mi-symbol-cmds.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/mi/mi-symbol-cmds.c	2011-08-04 19:28:09.486650227 +0100
@@ -37,6 +37,7 @@ mi_cmd_symbol_list_lines (char *command,
   struct symtab *s;
   int i;
   struct cleanup *cleanup_stack, *cleanup_tuple;
+  struct ui_out *uiout = current_uiout;
 
   if (argc != 1)
     error (_("-symbol-list-lines: Usage: SOURCE_FILENAME"));
Index: src/gdb/osdata.c
===================================================================
--- src.orig/gdb/osdata.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/osdata.c	2011-08-04 19:28:09.486650227 +0100
@@ -291,6 +291,7 @@ get_osdata_column (struct osdata_item *i
 static void
 info_osdata_command (char *type, int from_tty)
 {
+  struct ui_out *uiout = current_uiout;
   struct osdata *osdata = NULL;
   struct osdata_item *last;
   struct cleanup *old_chain;
Index: src/gdb/progspace.c
===================================================================
--- src.orig/gdb/progspace.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/progspace.c	2011-08-04 19:28:09.486650227 +0100
@@ -397,7 +397,7 @@ maintenance_info_program_spaces_command
 	error (_("program space ID %d not known."), requested);
     }
 
-  print_program_space (uiout, requested);
+  print_program_space (current_uiout, requested);
 }
 
 /* Simply returns the count of program spaces.  */
Index: src/gdb/python/py-auto-load.c
===================================================================
--- src.orig/gdb/python/py-auto-load.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/python/py-auto-load.c	2011-08-04 19:28:09.486650227 +0100
@@ -494,6 +494,7 @@ collect_matching_scripts (void **slot, v
 static void
 print_script (struct loaded_script *script)
 {
+  struct ui_out *uiout = current_uiout;
   struct cleanup *chain;
 
   chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
@@ -530,6 +531,7 @@ sort_scripts_by_name (const void *ap, co
 static void
 info_auto_load_scripts (char *pattern, int from_tty)
 {
+  struct ui_out *uiout = current_uiout;
   struct auto_load_pspace_info *pspace_info;
   struct cleanup *script_chain;
   VEC (loaded_script_ptr) *scripts;
Index: src/gdb/python/py-breakpoint.c
===================================================================
--- src.orig/gdb/python/py-breakpoint.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/python/py-breakpoint.c	2011-08-04 19:28:09.486650227 +0100
@@ -492,12 +492,12 @@ bppy_get_commands (PyObject *self, void
   string_file = mem_fileopen ();
   chain = make_cleanup_ui_file_delete (string_file);
 
-  ui_out_redirect (uiout, string_file);
+  ui_out_redirect (current_uiout, string_file);
   TRY_CATCH (except, RETURN_MASK_ALL)
     {
-      print_command_lines (uiout, breakpoint_commands (bp), 0);
+      print_command_lines (current_uiout, breakpoint_commands (bp), 0);
     }
-  ui_out_redirect (uiout, NULL);
+  ui_out_redirect (current_uiout, NULL);
   GDB_PY_HANDLE_EXCEPTION (except);
 
   cmdstr = ui_file_xstrdup (string_file, &length);
Index: src/gdb/remote-fileio.c
===================================================================
--- src.orig/gdb/remote-fileio.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/remote-fileio.c	2011-08-04 19:28:09.496650227 +0100
@@ -1416,7 +1416,8 @@ remote_fileio_request (char *buf, int ct
       remote_fio_ctrl_c_flag = 0;
       remote_fio_no_longjmp = 0;
 
-      ex = catch_exceptions (uiout, do_remote_fileio_request, (void *)buf,
+      ex = catch_exceptions (current_uiout,
+			     do_remote_fileio_request, (void *)buf,
 			     RETURN_MASK_ALL);
       switch (ex)
 	{
Index: src/gdb/remote.c
===================================================================
--- src.orig/gdb/remote.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/remote.c	2011-08-04 19:28:09.496650227 +0100
@@ -10541,6 +10541,7 @@ show_remote_cmd (char *args, int from_tt
      the redundant "show remote Z-packet" and the legacy aliases.  */
   struct cleanup *showlist_chain;
   struct cmd_list_element *list = remote_show_cmdlist;
+  struct ui_out *uiout = current_uiout;
 
   showlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist");
   for (; list != NULL; list = list->next)
Index: src/gdb/solib.c
===================================================================
--- src.orig/gdb/solib.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/solib.c	2011-08-04 19:28:09.496650227 +0100
@@ -1009,6 +1009,7 @@ info_sharedlibrary_command (char *patter
   int nr_libs;
   struct cleanup *table_cleanup;
   struct gdbarch *gdbarch = target_gdbarch;
+  struct ui_out *uiout = current_uiout;
 
   if (pattern)
     {
Index: src/gdb/source.c
===================================================================
--- src.orig/gdb/source.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/source.c	2011-08-04 19:28:09.496650227 +0100
@@ -1277,6 +1277,7 @@ print_source_lines_base (struct symtab *
   FILE *stream;
   int nlines = stopline - line;
   struct cleanup *cleanup;
+  struct ui_out *uiout = current_uiout;
 
   /* Regardless of whether we can open the file, set current_source_symtab.  */
   current_source_symtab = s;
Index: src/gdb/stack.c
===================================================================
--- src.orig/gdb/stack.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/stack.c	2011-08-04 19:28:09.496650227 +0100
@@ -119,7 +119,7 @@ print_stack_frame (struct frame_info *fr
   volatile struct gdb_exception e;
 
   /* For mi, alway print location and address.  */
-  if (ui_out_is_mi_like_p (uiout))
+  if (ui_out_is_mi_like_p (current_uiout))
     print_what = LOC_AND_ADDRESS;
 
   TRY_CATCH (e, RETURN_MASK_ERROR)
@@ -175,6 +175,7 @@ static void
 print_frame_args (struct symbol *func, struct frame_info *frame,
 		  int num, struct ui_file *stream)
 {
+  struct ui_out *uiout = current_uiout;
   int first = 1;
   /* Offset of next stack argument beyond the one we have seen that is
      at the highest offset, or -1 if we haven't come to a stack
@@ -436,8 +437,9 @@ do_gdb_disassembly (struct gdbarch *gdba
 
   TRY_CATCH (exception, RETURN_MASK_ERROR)
     {
-      gdb_disassembly (gdbarch, uiout, 0, DISASSEMBLY_RAW_INSN, how_many, low,
-		       high);
+      gdb_disassembly (gdbarch, current_uiout, 0,
+		       DISASSEMBLY_RAW_INSN, how_many,
+		       low, high);
     }
   if (exception.reason < 0)
     {
@@ -466,6 +468,7 @@ print_frame_info (struct frame_info *fra
   struct symtab_and_line sal;
   int source_print;
   int location_print;
+  struct ui_out *uiout = current_uiout;
 
   if (get_frame_type (frame) == DUMMY_FRAME
       || get_frame_type (frame) == SIGTRAMP_FRAME
@@ -698,6 +701,7 @@ print_frame (struct frame_info *frame, i
 	     struct symtab_and_line sal)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
+  struct ui_out *uiout = current_uiout;
   char *funname = NULL;
   enum language funlang = language_unknown;
   struct ui_stream *stb;
Index: src/gdb/symfile-mem.c
===================================================================
--- src.orig/gdb/symfile-mem.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/symfile-mem.c	2011-08-04 19:28:09.496650227 +0100
@@ -205,7 +205,7 @@ add_vsyscall_page (struct target_ops *ta
 	 vsyscall DSO was not triggered by the user, even if the user
 	 typed "run" at the TTY.  */
       args.from_tty = 0;
-      catch_exceptions (uiout, symbol_file_add_from_memory_wrapper,
+      catch_exceptions (current_uiout, symbol_file_add_from_memory_wrapper,
 			&args, RETURN_MASK_ALL);
     }
 }
Index: src/gdb/symfile.c
===================================================================
--- src.orig/gdb/symfile.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/symfile.c	2011-08-04 19:28:09.496650227 +0100
@@ -1864,7 +1864,7 @@ load_progress (ULONGEST bytes, void *unt
     {
       /* The write is just starting.  Let the user know we've started
 	 this section.  */
-      ui_out_message (uiout, 0, "Loading section %s, size %s lma %s\n",
+      ui_out_message (current_uiout, 0, "Loading section %s, size %s lma %s\n",
 		      args->section_name, hex_string (args->section_size),
 		      paddress (target_gdbarch, args->lma));
       return;
@@ -1976,6 +1976,7 @@ generic_load (char *args, int from_tty)
   struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
   struct load_section_data cbdata;
   struct load_progress_data total_progress;
+  struct ui_out *uiout = current_uiout;
 
   CORE_ADDR entry;
   char **argv;
@@ -2103,6 +2104,7 @@ print_transfer_performance (struct ui_fi
 			    const struct timeval *end_time)
 {
   ULONGEST time_count;
+  struct ui_out *uiout = current_uiout;
 
   /* Compute the elapsed time in milliseconds, as a tradeoff between
      accuracy and overflow.  */
Index: src/gdb/thread.c
===================================================================
--- src.orig/gdb/thread.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/thread.c	2011-08-04 19:28:09.506650227 +0100
@@ -971,7 +971,7 @@ No selected thread.  See `help thread'.\
 static void
 info_threads_command (char *arg, int from_tty)
 {
-  print_thread_info (uiout, arg, -1);
+  print_thread_info (current_uiout, arg, -1);
 }
 
 /* Switch from one thread to another.  */
@@ -1063,7 +1063,7 @@ restore_selected_frame (struct frame_id
   select_frame (get_current_frame ());
 
   /* Warn the user.  */
-  if (frame_level > 0 && !ui_out_is_mi_like_p (uiout))
+  if (frame_level > 0 && !ui_out_is_mi_like_p (current_uiout))
     {
       warning (_("Couldn't restore frame #%d in "
 		 "current thread, at reparsed frame #0\n"),
@@ -1292,7 +1292,7 @@ thread_command (char *tidstr, int from_t
       return;
     }
 
-  gdb_thread_select (uiout, tidstr, NULL);
+  gdb_thread_select (current_uiout, tidstr, NULL);
 }
 
 /* Implementation of `thread name'.  */
Index: src/gdb/top.c
===================================================================
--- src.orig/gdb/top.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/top.c	2011-08-04 19:28:09.506650227 +0100
@@ -504,10 +504,10 @@ execute_command_to_string (char *p, int
   make_cleanup_restore_ui_file (&gdb_stdtarg);
   make_cleanup_restore_ui_file (&gdb_stdtargerr);
 
-  if (ui_out_redirect (uiout, str_file) < 0)
+  if (ui_out_redirect (current_uiout, str_file) < 0)
     warning (_("Current output protocol does not support redirection"));
   else
-    make_cleanup_ui_out_redirect_pop (uiout);
+    make_cleanup_ui_out_redirect_pop (current_uiout);
 
   gdb_stdout = str_file;
   gdb_stderr = str_file;
Index: src/gdb/tracepoint.c
===================================================================
--- src.orig/gdb/tracepoint.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/tracepoint.c	2011-08-04 19:28:09.506650227 +0100
@@ -457,6 +457,7 @@ tvariables_info_1 (void)
   int ix;
   int count = 0;
   struct cleanup *back_to;
+  struct ui_out *uiout = current_uiout;
 
   if (VEC_length (tsv_s, tvariables) == 0 && !ui_out_is_mi_like_p (uiout))
     {
@@ -1811,6 +1812,7 @@ trace_status_command (char *args, int fr
 void
 trace_status_mi (int on_stop)
 {
+  struct ui_out *uiout = current_uiout;
   struct trace_status *ts = current_trace_status ();
   int status;
 
@@ -1950,6 +1952,7 @@ tfind_1 (enum trace_find_type type, int
   int target_frameno = -1, target_tracept = -1;
   struct frame_id old_frame_id = null_frame_id;
   struct tracepoint *tp;
+  struct ui_out *uiout = current_uiout;
 
   /* Only try to get the current stack frame if we have a chance of
      succeeding.  In particular, if we're trying to get a first trace
@@ -4366,6 +4369,7 @@ print_one_static_tracepoint_marker (int
 
   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;
@@ -4483,6 +4487,7 @@ info_static_tracepoint_markers_command (
   VEC(static_tracepoint_marker_p) *markers;
   struct cleanup *old_chain;
   struct static_tracepoint_marker *marker;
+  struct ui_out *uiout = current_uiout;
   int i;
 
   old_chain
Index: src/gdb/tui/tui-interp.c
===================================================================
--- src.orig/gdb/tui/tui-interp.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/tui/tui-interp.c	2011-08-04 19:28:09.506650227 +0100
@@ -178,10 +178,10 @@ tui_command_loop (void *data)
          preserves the uiout from changing, this must be done at top
          level of event loop.  */
       if (tui_active)
-        uiout = tui_out;
+        current_uiout = tui_out;
       else
-        uiout = tui_old_uiout;
-      
+        current_uiout = tui_old_uiout;
+
       if (result == 0)
 	{
 	  /* If any exception escaped to here, we better enable
Index: src/gdb/tui/tui-io.c
===================================================================
--- src.orig/gdb/tui/tui-io.c	2011-08-03 18:35:30.000000000 +0100
+++ src/gdb/tui/tui-io.c	2011-08-04 19:28:09.506650227 +0100
@@ -530,7 +530,7 @@ tui_setup_io (int mode)
       /* Keep track of previous gdb output.  */
       tui_old_stdout = gdb_stdout;
       tui_old_stderr = gdb_stderr;
-      tui_old_uiout = uiout;
+      tui_old_uiout = current_uiout;
 
       /* Reconfigure gdb output.  */
       gdb_stdout = tui_stdout;
@@ -538,7 +538,7 @@ tui_setup_io (int mode)
       gdb_stdlog = gdb_stdout;	/* for moment */
       gdb_stdtarg = gdb_stderr;	/* for moment */
       gdb_stdtargerr = gdb_stderr;	/* for moment */
-      uiout = tui_out;
+      current_uiout = tui_out;
 
       /* Save tty for SIGCONT.  */
       savetty ();
@@ -551,7 +551,7 @@ tui_setup_io (int mode)
       gdb_stdlog = gdb_stdout;	/* for moment */
       gdb_stdtarg = gdb_stderr;	/* for moment */
       gdb_stdtargerr = gdb_stderr;	/* for moment */
-      uiout = tui_old_uiout;
+      current_uiout = tui_old_uiout;
 
       /* Restore readline.  */
       rl_redisplay_function = tui_old_rl_redisplay_function;
@@ -607,7 +607,7 @@ tui_initialize_io (void)
 
   /* Create the default UI.  It is not created because we installed a
      deprecated_init_ui_hook.  */
-  tui_old_uiout = uiout = cli_out_new (gdb_stdout);
+  tui_old_uiout = current_uiout = cli_out_new (gdb_stdout);
 
 #ifdef TUI_USE_PIPE_FOR_READLINE
   /* Temporary solution for readline writing to stdout: redirect


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]