Re: [PATCH] [PR gdb/27026] CTRL-C is ignored when debug info is downloaded

Aaron Merey via Gdb-patches
2021-12-14T22:32:59Z

Hi Tom,

On Wed, Dec 1, 2021 at 11:45 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Aaron" == Aaron Merey via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Aaron> + gdb::optional<target_terminal::scoped_restore_terminal_state> term_state;
> Aaron> + if (target_supports_terminal_ours ())
> Aaron> + {
> Aaron> + term_state.emplace ();
> Aaron> + target_terminal::ours ();
> Aaron> + }
>
> I was curious to know if the gdb::optional and the
> target_supports_terminal_ours checks are really needed here.
> I think plenty of spots do this stuff unconditionally, so I
> was wondering if this code has some special need.

These checks came from Tom's draft of this patch. AFAICT it's done
out of an abundance of caution in case this code runs before any
inferior is loaded. I'm not sure that is currently possible but I think
it's better to be safe than sorry here.

Aaron