Make error usable earlier
authorGary Benson <gbenson@redhat.com>
Tue, 5 Aug 2014 12:25:48 +0000 (13:25 +0100)
committerGary Benson <gbenson@redhat.com>
Fri, 29 Aug 2014 09:11:59 +0000 (10:11 +0100)
error (and other exception-throwing functions) are callable from the
first line of captured_main, but the exception printing code will
crash if called before the first call to set_width.  This commit makes
the exception printing code usable from the moment gdb_stderr is set
up.

gdb/ChangeLog:

* exceptions.c (print_flush): Protect calls to
target_terminal_ours and wrap_here.

gdb/ChangeLog
gdb/exceptions.c

index 1a086ca2103bb403d9d5b01a644aba6affbe7fd4..8504cb913219c3b871e2b28b3428cc76ad30d4c6 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-29  Gary Benson  <gbenson@redhat.com>
+
+       * exceptions.c (print_flush): Protect calls to
+       target_terminal_ours and wrap_here.
+
 2014-08-29  Gary Benson  <gbenson@redhat.com>
 
        * utils.h (filtered_printing_initialized): New declaration.
index 38e966c4ed0aff9418a2ef930490870909f2055e..063d2b15664fee1b2d61a324317297df80448a5c 100644 (file)
@@ -239,7 +239,9 @@ print_flush (void)
 
   if (deprecated_error_begin_hook)
     deprecated_error_begin_hook ();
-  target_terminal_ours ();
+
+  if (target_supports_terminal_ours ())
+    target_terminal_ours ();
 
   /* 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
@@ -247,7 +249,8 @@ print_flush (void)
      too):  */
 
   /* 1.  The _filtered buffer.  */
-  wrap_here ("");
+  if (filtered_printing_initialized ())
+    wrap_here ("");
 
   /* 2.  The stdio buffer.  */
   gdb_flush (gdb_stdout);
This page took 0.031703 seconds and 4 git commands to generate.