]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Handle ^C in gnu_source_highlight_test
authorTom de Vries <tdevries@suse.de>
Tue, 24 Sep 2024 11:41:42 +0000 (13:41 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 24 Sep 2024 11:41:42 +0000 (13:41 +0200)
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.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/source-cache.c

index 2815b6e711d5b26861c1c88a5829dd326d60c291..f08c872ed8c77c19bc2906381ec3a2a994ed8b5c 100644 (file)
@@ -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;