This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 21/30] Use target_terminal_ours_for_output in exceptions.c
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 18 Mar 2016 19:18:25 +0000
- Subject: [PATCH 21/30] Use target_terminal_ours_for_output in exceptions.c
- Authentication-results: sourceware.org; auth=none
- References: <1458328714-4938-1-git-send-email-palves at redhat dot com>
We're only doing output here, so leave raw/cooked mode alone, as well
as the SIGINT handler.
Restore terminal settings after output, while at it.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* exceptions.c (print_flush): Use target_terminal_ours_for_output
instead of target_terminal_ours, and restore target terminal with
a cleanup.
---
gdb/exceptions.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index b457838..ffdd1f37 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -37,12 +37,16 @@ static void
print_flush (void)
{
struct serial *gdb_stdout_serial;
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
if (deprecated_error_begin_hook)
deprecated_error_begin_hook ();
if (target_supports_terminal_ours ())
- target_terminal_ours ();
+ {
+ make_cleanup_restore_target_terminal ();
+ target_terminal_ours_for_output ();
+ }
/* 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
@@ -66,6 +70,8 @@ print_flush (void)
}
annotate_error_begin ();
+
+ do_cleanups (old_chain);
}
static void
--
2.5.0