From 0d2f5c0791fda17ebbc503c5e7716fcb619318fc Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Tue, 5 Aug 2014 13:27:49 +0100 Subject: [PATCH] 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/ChangeLog: * 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/ChangeLog b/gdb/ChangeLog index 8504cb91321..9f02aad7dab 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-08-29 Gary Benson + + * utils.c (vwarning): Protect calls to target_terminal_ours + and wrap_here. + 2014-08-29 Gary Benson * exceptions.c (print_flush): Protect calls to diff --git a/gdb/utils.c b/gdb/utils.c index 5fe9ee6b1fe..9785a6117d1 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -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); -- 2.30.2