aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-08-05 13:27:49 +0100
committerGary Benson <gbenson@redhat.com>2014-08-29 10:12:00 +0100
commit0d2f5c0791fda17ebbc503c5e7716fcb619318fc (patch)
tree1322f6c15840caca6f0b040ab30fb99f45dc281a /gdb/utils.c
parent5df43998152f7096f8eed45c24a4fad5a3244d8b (diff)
downloadgdb-0d2f5c0791fda17ebbc503c5e7716fcb619318fc.zip
gdb-0d2f5c0791fda17ebbc503c5e7716fcb619318fc.tar.gz
gdb-0d2f5c0791fda17ebbc503c5e7716fcb619318fc.tar.bz2
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.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 5fe9ee6..9785a61 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);