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

[PATCH 3/8] Make warning usable earlier


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/
2014-08-05  Gary Benson  <gbenson@redhat.com>

	* utils.c (vwarning): Protect calls to target_terminal_ours
	and wrap_here.
---
 gdb/ChangeLog |    5 +++++
 gdb/utils.c   |    6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gdb/utils.c b/gdb/utils.c
index fce5baa..5a1269c 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -522,8 +522,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);
-- 
1.7.1


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