aboutsummaryrefslogtreecommitdiff
path: root/gdb/exceptions.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-08-05 13:25:48 +0100
committerGary Benson <gbenson@redhat.com>2014-08-29 10:11:59 +0100
commit5df43998152f7096f8eed45c24a4fad5a3244d8b (patch)
treedfa1349c4c4ba1aac8d5ffdfcc52e01f8a7c06aa /gdb/exceptions.c
parent2437fd32f17cb11338949cff1fd0741e14ce1681 (diff)
Make error usable earlier
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.
Diffstat (limited to 'gdb/exceptions.c')
-rw-r--r--gdb/exceptions.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 38e966c4ed..063d2b1566 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -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);