gdb: defer commit resume until all available events are consumed
[deliverable/binutils-gdb.git] / gdb / exceptions.c
index 078f3c3bf00c995c052b6624826078958aa532f5..7e15551e015e5274cca83fbaeac897b12ee6f69c 100644 (file)
@@ -1,6 +1,6 @@
 /* Exception (throw catch) mechanism, for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -27,7 +27,7 @@
 #include "serial.h"
 #include "gdbthread.h"
 #include "top.h"
-#include "common/gdb_optional.h"
+#include "gdbsupport/gdb_optional.h"
 
 static void
 print_flush (void)
@@ -39,11 +39,7 @@ print_flush (void)
     deprecated_error_begin_hook ();
 
   gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
-  /* While normally there's always something pushed on the target
-     stack, the NULL check is needed here because we can get here very
-     early during startup, before the target stack is first
-     initialized.  */
-  if (current_top_target () != NULL && target_supports_terminal_ours ())
+  if (target_supports_terminal_ours ())
     {
       term_state.emplace ();
       target_terminal::ours_for_output ();
@@ -74,9 +70,9 @@ print_flush (void)
 }
 
 static void
-print_exception (struct ui_file *file, struct gdb_exception e)
+print_exception (struct ui_file *file, const struct gdb_exception &e)
 {
-  /* KLUGE: cagney/2005-01-13: Write the string out one line at a time
+  /* KLUDGE: cagney/2005-01-13: Write the string out one line at a time
      as that way the MI's behavior is preserved.  */
   const char *start;
   const char *end;
@@ -89,7 +85,7 @@ print_exception (struct ui_file *file, struct gdb_exception e)
       else
        {
          end++;
-         ui_file_write (file, start, end - start);
+         file->write (start, end - start);
        }
     }                                      
   fprintf_filtered (file, "\n");
@@ -110,7 +106,7 @@ print_exception (struct ui_file *file, struct gdb_exception e)
 }
 
 void
-exception_print (struct ui_file *file, struct gdb_exception e)
+exception_print (struct ui_file *file, const struct gdb_exception &e)
 {
   if (e.reason < 0 && e.message != NULL)
     {
@@ -120,7 +116,7 @@ exception_print (struct ui_file *file, struct gdb_exception e)
 }
 
 void
-exception_fprintf (struct ui_file *file, struct gdb_exception e,
+exception_fprintf (struct ui_file *file, const struct gdb_exception &e,
                   const char *prefix, ...)
 {
   if (e.reason < 0 && e.message != NULL)
@@ -141,7 +137,8 @@ exception_fprintf (struct ui_file *file, struct gdb_exception e,
 /* See exceptions.h.  */
 
 int
-exception_print_same (struct gdb_exception e1, struct gdb_exception e2)
+exception_print_same (const struct gdb_exception &e1,
+                     const struct gdb_exception &e2)
 {
   const char *msg1 = e1.message == nullptr ? "" : e1.what ();
   const char *msg2 = e2.message == nullptr ? "" : e2.what ();
This page took 0.02562 seconds and 4 git commands to generate.