From: Tom de Vries Date: Tue, 24 Sep 2024 11:41:42 +0000 (+0200) Subject: [gdb] Handle ^C in gnu_source_highlight_test X-Git-Tag: gdb-16-branchpoint~832 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3926d6ad14413ca64e7828c98823c52d7e74307;p=thirdparty%2Fbinutils-gdb.git [gdb] Handle ^C in gnu_source_highlight_test 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 --- diff --git a/gdb/source-cache.c b/gdb/source-cache.c index 2815b6e711d..f08c872ed8c 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;