Change tui_show_symtab_source to be a method
[external/binutils.git] / gdb / mi / mi-interp.c
index 6a19bf0..9033a61 100644 (file)
@@ -38,7 +38,7 @@
 #include "cli-out.h"
 #include "thread-fsm.h"
 #include "cli/cli-interp.h"
-#include "common/scope-exit.h"
+#include "gdbsupport/scope-exit.h"
 
 /* These are the interpreter setup, etc. functions for the MI
    interpreter.  */
@@ -633,19 +633,19 @@ mi_on_normal_stop_1 (struct bpstats *bs, int print_frame)
       if (console_print)
        print_stop_event (mi->cli_uiout);
 
-      mi_uiout->field_int ("thread-id", tp->global_num);
+      mi_uiout->field_signed ("thread-id", tp->global_num);
       if (non_stop)
        {
          ui_out_emit_list list_emitter (mi_uiout, "stopped-threads");
 
-         mi_uiout->field_int (NULL, tp->global_num);
+         mi_uiout->field_signed (NULL, tp->global_num);
        }
       else
        mi_uiout->field_string ("stopped-threads", "all");
 
       core = target_core_of_thread (tp->ptid);
       if (core != -1)
-       mi_uiout->field_int ("core", core);
+       mi_uiout->field_signed ("core", core);
     }
   
   fputs_unfiltered ("*stopped", mi->raw_stdout);
@@ -1034,7 +1034,7 @@ mi_output_solib_attribs (ui_out *uiout, struct so_list *solib)
   uiout->field_string ("id", solib->so_original_name);
   uiout->field_string ("target-name", solib->so_original_name);
   uiout->field_string ("host-name", solib->so_name);
-  uiout->field_int ("symbols-loaded", solib->symbols_loaded);
+  uiout->field_signed ("symbols-loaded", solib->symbols_loaded);
   if (!gdbarch_has_global_solist (target_gdbarch ()))
       uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
 
@@ -1172,7 +1172,7 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr,
 
       mi_uiout->field_fmt ("thread-group", "i%d", inferior->num);
       mi_uiout->field_core_addr ("addr", target_gdbarch (), memaddr);
-      mi_uiout->field_fmt ("len", "%s", hex_string (len));
+      mi_uiout->field_string ("len", hex_string (len));
 
       /* Append 'type=code' into notification if MEMADDR falls in the range of
         sections contain code.  */
@@ -1279,7 +1279,8 @@ mi_interp::interp_ui_out ()
    the consoles to use the supplied ui-file(s).  */
 
 void
-mi_interp::set_logging (ui_file_up logfile, bool logging_redirect)
+mi_interp::set_logging (ui_file_up logfile, bool logging_redirect,
+                       bool debug_redirect)
 {
   struct mi_interp *mi = this;
 
@@ -1289,22 +1290,30 @@ mi_interp::set_logging (ui_file_up logfile, bool logging_redirect)
 
       /* If something is being redirected, then grab logfile.  */
       ui_file *logfile_p = nullptr;
-      if (logging_redirect)
-       logfile_p = logfile.release ();
+      if (logging_redirect || debug_redirect)
+       {
+         logfile_p = logfile.get ();
+         mi->saved_raw_file_to_delete = logfile_p;
+       }
 
       /* If something is not being redirected, then a tee containing both the
         logfile and stdout.  */
       ui_file *tee = nullptr;
-      if (!logging_redirect)
-       tee = new tee_file (mi->raw_stdout, std::move (logfile));
+      if (!logging_redirect || !debug_redirect)
+       {
+         tee = new tee_file (mi->raw_stdout, std::move (logfile));
+         mi->saved_raw_file_to_delete = tee;
+       }
 
       mi->raw_stdout = logging_redirect ? logfile_p : tee;
+      mi->raw_stdlog = debug_redirect ? logfile_p : tee;
     }
   else
     {
-      delete mi->raw_stdout;
+      delete mi->saved_raw_file_to_delete;
       mi->raw_stdout = mi->saved_raw_stdout;
       mi->saved_raw_stdout = nullptr;
+      mi->saved_raw_file_to_delete = nullptr;
     }
 
   mi->out->set_raw (mi->raw_stdout);