aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/lib/gdb/dap/launch.py10
1 files changed, 8 insertions, 2 deletions
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