aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-11-16 10:44:42 -0700
committerTom Tromey <tromey@adacore.com>2023-12-11 11:44:33 -0700
commit3a12e74ecedfc416aafeda26dbe335ad7962a283 (patch)
tree3887e5a68052763ffc5a9f7256bf78859cd67d45 /gdb/doc
parentf895e1592d5f4e58776e6a2d7ccdcc028cc5df80 (diff)
downloadgdb-3a12e74ecedfc416aafeda26dbe335ad7962a283.zip
gdb-3a12e74ecedfc416aafeda26dbe335ad7962a283.tar.gz
gdb-3a12e74ecedfc416aafeda26dbe335ad7962a283.tar.bz2
Introduce gdb.interrupt
DAP cancellation needs a way to interrupt whatever is happening on gdb's main thread -- whether that is the inferior, a gdb CLI command, or Python code. This patch adds a new gdb.interrupt() function for this purpose. It simply sets the quit flag and lets gdb do the rest. No tests in this patch -- instead this is tested via the DAP cancellation tests. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/python.texi11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 39137aa..d74defe 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -664,6 +664,17 @@ this an easy-to-use drop-in replacement for creating threads that will
work well in @value{GDBN}.
@end deftp
+@defun gdb.interrupt ()
+This causes @value{GDBN} to react as if the user had typed a control-C
+character at the terminal. That is, if the inferior is running, it is
+interrupted; if a @value{GDBN} command is executing, it is stopped;
+and if a Python command is running, @code{KeyboardInterrupt} will be
+raised.
+
+Unlike most Python APIs in @value{GDBN}, @code{interrupt} is
+thread-safe.
+@end defun
+
@defun gdb.post_event (event)
Put @var{event}, a callable object taking no arguments, into
@value{GDBN}'s internal event queue. This callable will be invoked at