aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-05-16 09:34:20 -0600
committerTom Tromey <tromey@adacore.com>2023-06-12 12:09:56 -0600
commit67efac36f17824b147b3d4645719404ccd662206 (patch)
treed31f11164e20dbf2507a991be2ffa9f6a5784485 /gdb/python
parent8115dffa1e76ab007223199dfbc8c1298d2bf06e (diff)
downloadgdb-67efac36f17824b147b3d4645719404ccd662206.zip
gdb-67efac36f17824b147b3d4645719404ccd662206.tar.gz
gdb-67efac36f17824b147b3d4645719404ccd662206.tar.bz2
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 <eliz@gnu.org>
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