aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/lib
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-11-20 11:13:28 -0700
committerTom Tromey <tromey@adacore.com>2024-12-09 13:52:54 -0700
commit278b1d211ddbe0136168bc4a7346a0eb67adf1ab (patch)
tree6fce3ec2cc943a4c6b955b88d4b8e352356d9735 /gdb/python/lib
parent00ce087f83783b31455509401d0b9d3869fcc8be (diff)
downloadbinutils-278b1d211ddbe0136168bc4a7346a0eb67adf1ab.zip
binutils-278b1d211ddbe0136168bc4a7346a0eb67adf1ab.tar.gz
binutils-278b1d211ddbe0136168bc4a7346a0eb67adf1ab.tar.bz2
Add call_function_later to DAP
This adds a new call_function_later API to DAP. This arranges to run a function after the current request has completed. This isn't used yet, but will be at the end of this series. Reviewed-by: Kévin Le Gouguec <legouguec@adacore.com>
Diffstat (limited to 'gdb/python/lib')
-rw-r--r--gdb/python/lib/gdb/dap/server.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/python/lib/gdb/dap/server.py b/gdb/python/lib/gdb/dap/server.py
index ceffefc..0919045 100644
--- a/gdb/python/lib/gdb/dap/server.py
+++ b/gdb/python/lib/gdb/dap/server.py
@@ -281,6 +281,12 @@ class Server:
return
self.send_event(event, body)
+ @in_dap_thread
+ def call_function_later(self, fn):
+ """Call FN later -- after the current request's response has been sent."""
+ with self.delayed_fns_lock:
+ self.delayed_fns.append(fn)
+
# Note that this does not need to be run in any particular thread,
# because it just creates an object and writes it to a thread-safe
# queue.
@@ -321,6 +327,12 @@ def send_event_maybe_later(event, body=None):
_server.send_event_maybe_later(event, body)
+def call_function_later(fn):
+ """Call FN later -- after the current request's response has been sent."""
+ global _server
+ _server.call_function_later(fn)
+
+
# A helper decorator that checks whether the inferior is running.
def _check_not_running(func):
@functools.wraps(func)