[PATCH 2/8] Make error usable earlier
Gary Benson
gbenson@redhat.com
Wed Aug 6 10:12:00 GMT 2014
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/
2014-08-05 Gary Benson <gbenson@redhat.com>
* exceptions.c (print_flush): Protect calls to
target_terminal_ours and wrap_here.
---
gdb/ChangeLog | 5 +++++
gdb/exceptions.c | 7 +++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index ddaf250..377d073 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -241,7 +241,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
@@ -249,7 +251,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);
--
1.7.1
More information about the Gdb-patches
mailing list