This is the mail archive of the gdb-cvs@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]

[binutils-gdb] Use target_terminal_ours_for_output in exceptions.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=481ac8c9bbbfc4b7506dfdb4a5b92b859d5c47d9

commit 481ac8c9bbbfc4b7506dfdb4a5b92b859d5c47d9
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Apr 12 16:49:31 2016 +0100

    Use target_terminal_ours_for_output in exceptions.c
    
    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.

Diff:
---
 gdb/ChangeLog    | 6 ++++++
 gdb/exceptions.c | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cdaf648..857d5e5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 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
 	instead of target_terminal_ours, and restore target terminal with
 	a cleanup.
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index b457838..ffdd1f3 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -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


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