[23/30] Use target_terminal_ours_for_output in warning/internal_error
Commit Message
We're only doing output here, so leave raw/cooked mode alone, as well
as the SIGINT handler.
And restore terminal settings, while at it.
gdb/ChangeLog:
YYYY-MM-DD Pedro Alves <palves@redhat.com>
* utils.c (vwarning, internal_vproblem): Use
make_cleanup_restore_target_terminal and
target_terminal_ours_for_output.
---
gdb/utils.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
@@ -503,8 +503,13 @@ vwarning (const char *string, va_list args)
(*deprecated_warning_hook) (string, args);
else
{
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+
if (target_supports_terminal_ours ())
- target_terminal_ours ();
+ {
+ make_cleanup_restore_target_terminal ();
+ target_terminal_ours_for_output ();
+ }
if (filtered_printing_initialized ())
wrap_here (""); /* Force out any buffered output. */
gdb_flush (gdb_stdout);
@@ -512,6 +517,8 @@ vwarning (const char *string, va_list args)
fputs_unfiltered (warning_pre_print, gdb_stderr);
vfprintf_unfiltered (gdb_stderr, string, args);
fprintf_unfiltered (gdb_stderr, "\n");
+
+ do_cleanups (old_chain);
}
}
@@ -709,7 +716,10 @@ internal_vproblem (struct internal_problem *problem,
/* Try to get the message out and at the start of a new line. */
if (target_supports_terminal_ours ())
- target_terminal_ours ();
+ {
+ make_cleanup_restore_target_terminal ();
+ target_terminal_ours_for_output ();
+ }
if (filtered_printing_initialized ())
begin_line ();