aboutsummaryrefslogtreecommitdiff
path: root/gdb/annotate.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-06-13 22:13:28 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-06-14 15:27:34 +0100
commit7c39e397aafaea64812f2611b061bdd50f30dce4 (patch)
treefc2e03944a4fd0851ed307904316d1a1a93a561e /gdb/annotate.c
parentf411722cbc18820e5266ec4c2aadd2269eb15447 (diff)
downloadgdb-7c39e397aafaea64812f2611b061bdd50f30dce4.zip
gdb-7c39e397aafaea64812f2611b061bdd50f30dce4.tar.gz
gdb-7c39e397aafaea64812f2611b061bdd50f30dce4.tar.bz2
gdb: Use scoped_restore_terminal_state in annotate.c
In a couple of places in annotate.c we are manually backing up and restoring the terminal ownership, we could instead make use of scoped_restore_terminal_state. gdb/ChangeLog: * annotate.c (annotate_breakpoints_invalid): Make use of scoped_restore_terminal_state. (annotate_frames_invalid): Likewise.
Diffstat (limited to 'gdb/annotate.c')
-rw-r--r--gdb/annotate.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/gdb/annotate.c b/gdb/annotate.c
index e6e8084..84940ff 100644
--- a/gdb/annotate.c
+++ b/gdb/annotate.c
@@ -61,17 +61,10 @@ annotate_breakpoints_invalid (void)
&& (!breakpoints_invalid_emitted
|| current_ui->prompt_state != PROMPT_BLOCKED))
{
- /* If the inferior owns the terminal (e.g., we're resuming),
- make sure to leave with the inferior still owning it. */
- int was_inferior = target_terminal::is_inferior ();
-
+ target_terminal::scoped_restore_terminal_state term_state;
target_terminal::ours_for_output ();
printf_unfiltered (("\n\032\032breakpoints-invalid\n"));
-
- if (was_inferior)
- target_terminal::inferior ();
-
breakpoints_invalid_emitted = 1;
}
}
@@ -208,17 +201,10 @@ annotate_frames_invalid (void)
&& (!frames_invalid_emitted
|| current_ui->prompt_state != PROMPT_BLOCKED))
{
- /* If the inferior owns the terminal (e.g., we're resuming),
- make sure to leave with the inferior still owning it. */
- int was_inferior = target_terminal::is_inferior ();
-
+ target_terminal::scoped_restore_terminal_state term_state;
target_terminal::ours_for_output ();
printf_unfiltered (("\n\032\032frames-invalid\n"));
-
- if (was_inferior)
- target_terminal::inferior ();
-
frames_invalid_emitted = 1;
}
}