[PING][PATCH 1/7] [gdb] Handle ^C in gnu_source_highlight_test

Tom de Vries tdevries@suse.de
Mon Sep 23 08:13:04 GMT 2024


On 8/27/24 16:00, Tom de Vries wrote:
> In gnu_source_highlight_test we have:
> ...
>    try
>      {
>        res = try_source_highlight (styled_prog, language_c, fullname);
>      }
>    catch (...)
>      {
>        saw_exception = true;
>      }
> ...
> 
> This also swallows gdb_exception_quit and gdb_exception_forced_quit.  I don't
> know whether these can actually happen here, but if not it's better to
> accommodate for the possibility anyway.
> 
> Fix this by handling gdb_exception explicitly, and rethrowing
> gdb_exception_quit and gdb_exception_forced_quit.
> 

Ping.

Thanks,
- Tom

> Tested on aarch64-linux.
> ---
>   gdb/source-cache.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/gdb/source-cache.c b/gdb/source-cache.c
> index 6af984fb88b..5486c1b8c2d 100644
> --- a/gdb/source-cache.c
> +++ b/gdb/source-cache.c
> @@ -282,6 +282,12 @@ static void gnu_source_highlight_test ()
>       {
>         res = try_source_highlight (styled_prog, language_c, fullname);
>       }
> +  catch (const gdb_exception &e)
> +    {
> +      if (e.reason != RETURN_ERROR)
> +	throw;
> +      saw_exception = true;
> +    }
>     catch (...)
>       {
>         saw_exception = true;
> 
> base-commit: fd8ec8ed8258990700aaf422cea0e12208356014



More information about the Gdb-patches mailing list