Introduce and use flush_streams
[deliverable/binutils-gdb.git] / gdb / event-loop.c
index ae9d27eedd78671cdef383e557b5990c722ba16f..4ce8899612c425c222dc128df8cab67c6b1eed90 100644 (file)
@@ -22,6 +22,8 @@
 #include "event-top.h"
 #include "ser-event.h"
 
+#include <chrono>
+
 #ifdef HAVE_POLL
 #if defined (HAVE_POLL_H)
 #include <poll.h>
@@ -614,11 +616,10 @@ handle_file_event (file_handler *file_ptr, int ready_mask)
                  /* Work in progress.  We may need to tell somebody
                     what kind of error we had.  */
                  if (mask & POLLERR)
-                   printf_unfiltered (_("Error detected on fd %d\n"),
-                                      file_ptr->fd);
+                   warning (_("Error detected on fd %d"), file_ptr->fd);
                  if (mask & POLLNVAL)
-                   printf_unfiltered (_("Invalid or non-`poll'able fd %d\n"),
-                                      file_ptr->fd);
+                   warning (_("Invalid or non-`poll'able fd %d"),
+                            file_ptr->fd);
                  file_ptr->error = 1;
                }
              else
@@ -632,8 +633,8 @@ handle_file_event (file_handler *file_ptr, int ready_mask)
            {
              if (ready_mask & GDB_EXCEPTION)
                {
-                 printf_unfiltered (_("Exception condition detected "
-                                      "on fd %d\n"), file_ptr->fd);
+                 warning (_("Exception condition detected on fd %d"),
+                          file_ptr->fd);
                  file_ptr->error = 1;
                }
              else
@@ -662,8 +663,7 @@ gdb_wait_for_event (int block)
   int num_found = 0;
 
   /* Make sure all output is done before getting another event.  */
-  gdb_stdout->flush ();
-  gdb_stderr->flush ();
+  flush_streams ();
 
   if (gdb_notifier.num_fds == 0)
     return -1;
This page took 0.024122 seconds and 4 git commands to generate.