From 67efac36f17824b147b3d4645719404ccd662206 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 16 May 2023 09:34:20 -0600 Subject: Add "target" parameter to DAP attach request This adds a new "target" to the DAP attach request. This is passed to "target remote". I thought "attach" made the most sense for this, because in some sense gdb is attaching to a running process. It's worth noting that all DAP "attach" parameters are defined by the implementation. Reviewed-By: Eli Zaretskii --- gdb/python/lib/gdb/dap/launch.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/lib/gdb/dap/launch.py b/gdb/python/lib/gdb/dap/launch.py index e187c31..2fec326 100644 --- a/gdb/python/lib/gdb/dap/launch.py +++ b/gdb/python/lib/gdb/dap/launch.py @@ -56,13 +56,19 @@ def launch( @request("attach") -def attach(*, pid: int, **args): +def attach(*, pid: Optional[int] = None, target: Optional[str] = None, **args): # Ensure configurationDone does not try to run. global _program _program = None + if pid is not None: + cmd = "attach " + str(pid) + elif target is not None: + cmd = "target remote " + target + else: + raise Exception("attach requires either 'pid' or 'target'") # Use send_gdb_with_response to ensure we get an error if the # attach fails. - send_gdb_with_response("attach " + str(pid)) + send_gdb_with_response(cmd) return None -- cgit v1.1