Make warning usable earlier
authorGary Benson <gbenson@redhat.com>
Tue, 5 Aug 2014 12:27:49 +0000 (13:27 +0100)
committerGary Benson <gbenson@redhat.com>
Fri, 29 Aug 2014 09:12:00 +0000 (10:12 +0100)
warning will crash if called before the first call to set_width.  This
commit makes the warning usable from the moment gdb_stderr is set up.

gdb/ChangeLog:

* utils.c (vwarning): Protect calls to target_terminal_ours
and wrap_here.

gdb/ChangeLog
gdb/utils.c

index 8504cb9..9f02aad 100644 (file)
@@ -1,5 +1,10 @@
 2014-08-29  Gary Benson  <gbenson@redhat.com>
 
+       * utils.c (vwarning): Protect calls to target_terminal_ours
+       and wrap_here.
+
+2014-08-29  Gary Benson  <gbenson@redhat.com>
+
        * exceptions.c (print_flush): Protect calls to
        target_terminal_ours and wrap_here.
 
index 5fe9ee6..9785a61 100644 (file)
@@ -520,8 +520,10 @@ vwarning (const char *string, va_list args)
     (*deprecated_warning_hook) (string, args);
   else
     {
-      target_terminal_ours ();
-      wrap_here ("");          /* Force out any buffered output.  */
+      if (target_supports_terminal_ours ())
+       target_terminal_ours ();
+      if (filtered_printing_initialized ())
+       wrap_here ("");         /* Force out any buffered output.  */
       gdb_flush (gdb_stdout);
       if (warning_pre_print)
        fputs_unfiltered (warning_pre_print, gdb_stderr);