public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Catch KeyboardInterrupt in send_gdb_with_response
@ 2023-12-11 18:54 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-12-11 18:54 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c0a652c2aa8858dba99d578fa2fac25b1a532a0a

commit c0a652c2aa8858dba99d578fa2fac25b1a532a0a
Author: Tom Tromey <tromey@adacore.com>
Date:   Thu Nov 30 13:57:09 2023 -0700

    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 <legouguec@adacore.com>

Diff:
---
 gdb/python/lib/gdb/dap/startup.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-11 18:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11 18:54 [binutils-gdb] Catch KeyboardInterrupt in send_gdb_with_response Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).