Use target_terminal_ours_for_output in exceptions.c
authorPedro Alves <palves@redhat.com>
Tue, 12 Apr 2016 15:49:31 +0000 (16:49 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 12 Apr 2016 15:58:35 +0000 (16:58 +0100)
We're only doing output here, so leave raw/cooked mode alone, as well
as the SIGINT handler.

Restore terminal settings after output, while at it.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

* exceptions.c (print_flush): Use target_terminal_ours_for_output
instead of target_terminal_ours, and restore target terminal with
a cleanup.

gdb/ChangeLog
gdb/exceptions.c

index cdaf648949465c457125193f674c2e934871e933..857d5e54c24c6e889608a16a5136fd65a64209ae 100644 (file)
@@ -1,3 +1,9 @@
+2016-04-12  Pedro Alves  <palves@redhat.com>
+
+       * exceptions.c (print_flush): Use target_terminal_ours_for_output
+       instead of target_terminal_ours, and restore target terminal with
+       a cleanup.
+
 2016-04-12  Pedro Alves  <palves@redhat.com>
 
        * cp-support.c (gdb_demangle): Use target_terminal_ours_for_output
index b457838d93a193f0e1b6d71aa2b79e44199055d5..ffdd1f37e0f6679d1135e8a3466db43d199e8e4b 100644 (file)
@@ -37,12 +37,16 @@ static void
 print_flush (void)
 {
   struct serial *gdb_stdout_serial;
+  struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
 
   if (deprecated_error_begin_hook)
     deprecated_error_begin_hook ();
 
   if (target_supports_terminal_ours ())
-    target_terminal_ours ();
+    {
+      make_cleanup_restore_target_terminal ();
+      target_terminal_ours_for_output ();
+    }
 
   /* We want all output to appear now, before we print the error.  We
      have 3 levels of buffering we have to flush (it's possible that
@@ -66,6 +70,8 @@ print_flush (void)
     }
 
   annotate_error_begin ();
+
+  do_cleanups (old_chain);
 }
 
 static void