]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Catch KeyboardInterrupt in send_gdb_with_response
authorTom Tromey <tromey@adacore.com>
Thu, 30 Nov 2023 20:57:09 +0000 (13:57 -0700)
committerTom Tromey <tromey@adacore.com>
Mon, 11 Dec 2023 18:44:35 +0000 (11:44 -0700)
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 <legouguec@adacore.com>
gdb/python/lib/gdb/dap/startup.py

index a16b51f7cf52ba46364d9daf1d38149ad020b4be..1d3b94762a6e8cd0ad5ba87bc7aae348a3921a06 100644 (file)
@@ -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