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 warning/internal_error


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

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

    Use target_terminal_ours_for_output in warning/internal_error
    
    We're only doing output here, so leave raw/cooked mode alone, as well
    as the SIGINT handler.
    
    And restore terminal settings, while at it.
    
    gdb/ChangeLog:
    2016-04-12  Pedro Alves  <palves@redhat.com>
    
    	* utils.c (vwarning, internal_vproblem): Use
    	make_cleanup_restore_target_terminal and
    	target_terminal_ours_for_output.

Diff:
---
 gdb/ChangeLog |  6 ++++++
 gdb/utils.c   | 14 ++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0de7a6d..595a43c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2016-04-12  Pedro Alves  <palves@redhat.com>
 
+	* utils.c (vwarning, internal_vproblem): Use
+	make_cleanup_restore_target_terminal and
+	target_terminal_ours_for_output.
+
+2016-04-12  Pedro Alves  <palves@redhat.com>
+
 	* infcmd.c (post_create_inferior, prepare_one_step): Use
 	target_terminal_ours_for_output instead of target_terminal_ours.
 
diff --git a/gdb/utils.c b/gdb/utils.c
index 3c7a29c..e44e76c 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -532,8 +532,13 @@ vwarning (const char *string, va_list args)
     (*deprecated_warning_hook) (string, args);
   else
     {
+      struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+
       if (target_supports_terminal_ours ())
-	target_terminal_ours ();
+	{
+	  make_cleanup_restore_target_terminal ();
+	  target_terminal_ours_for_output ();
+	}
       if (filtered_printing_initialized ())
 	wrap_here ("");		/* Force out any buffered output.  */
       gdb_flush (gdb_stdout);
@@ -541,6 +546,8 @@ vwarning (const char *string, va_list args)
 	fputs_unfiltered (warning_pre_print, gdb_stderr);
       vfprintf_unfiltered (gdb_stderr, string, args);
       fprintf_unfiltered (gdb_stderr, "\n");
+
+      do_cleanups (old_chain);
     }
 }
 
@@ -738,7 +745,10 @@ internal_vproblem (struct internal_problem *problem,
 
   /* Try to get the message out and at the start of a new line.  */
   if (target_supports_terminal_ours ())
-    target_terminal_ours ();
+    {
+      make_cleanup_restore_target_terminal ();
+      target_terminal_ours_for_output ();
+    }
   if (filtered_printing_initialized ())
     begin_line ();


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