From: Tom Tromey Date: Thu, 30 Nov 2023 20:57:09 +0000 (-0700) Subject: Catch KeyboardInterrupt in send_gdb_with_response X-Git-Tag: binutils-2_42~625 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c0a652c2aa8858dba99d578fa2fac25b1a532a0a;p=thirdparty%2Fbinutils-gdb.git Catch KeyboardInterrupt in send_gdb_with_response Cancellation will generally be seen by the DAP code as a KeyboardInterrupt. However, this derives from BaseException and not Exception, so a small change is needed to send_gdb_with_response, to forward the exception to the DAP server thread. Reviewed-By: Kévin Le Gouguec --- diff --git a/gdb/python/lib/gdb/dap/startup.py b/gdb/python/lib/gdb/dap/startup.py index a16b51f7cf5..1d3b94762a6 100644 --- a/gdb/python/lib/gdb/dap/startup.py +++ b/gdb/python/lib/gdb/dap/startup.py @@ -172,11 +172,11 @@ def send_gdb_with_response(fn): try: val = fn() result_q.put(val) - except Exception as e: + except (Exception, KeyboardInterrupt) as e: result_q.put(e) send_gdb(message) val = result_q.get() - if isinstance(val, Exception): + if isinstance(val, (Exception, KeyboardInterrupt)): raise val return val