diff options
author | Tom Tromey <tromey@adacore.com> | 2023-12-07 09:51:52 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-12-22 09:05:17 -0700 |
commit | eb6476e2db406ba323efba438b0d1851e86d02e5 (patch) | |
tree | 8887453aacc110380b5b0a7423160a229999bd04 /gdb/testsuite | |
parent | 401b5b00ecef262ce36a8810775087c7d9928900 (diff) | |
download | gdb-eb6476e2db406ba323efba438b0d1851e86d02e5.zip gdb-eb6476e2db406ba323efba438b0d1851e86d02e5.tar.gz gdb-eb6476e2db406ba323efba438b0d1851e86d02e5.tar.bz2 |
Add 'program' to DAP 'attach' request
In many cases, it's not possible for gdb to discover the executable
when a DAP 'attach' request is used. This patch lets the IDE supply
this information.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.dap/attach.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/lib/dap-support.exp | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.dap/attach.exp b/gdb/testsuite/gdb.dap/attach.exp index 5b308f9..4d56271 100644 --- a/gdb/testsuite/gdb.dap/attach.exp +++ b/gdb/testsuite/gdb.dap/attach.exp @@ -29,7 +29,7 @@ set test_spawn_id [spawn_wait_for_attach $binfile] set testpid [spawn_id_get_pid $test_spawn_id] # We just want to test that attaching works at all. -if {[dap_attach $testpid] != ""} { +if {[dap_attach $testpid $binfile] != ""} { dap_shutdown true } diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp index b9ac314..8186148 100644 --- a/gdb/testsuite/lib/dap-support.exp +++ b/gdb/testsuite/lib/dap-support.exp @@ -306,12 +306,17 @@ proc dap_launch {file {args {}}} { # Start gdb, send a DAP initialize request, and then an attach request # specifying PID as the inferior process ID. Returns the empty string # on failure, or the response object from the attach request. -proc dap_attach {pid} { +proc dap_attach {pid {prog ""}} { if {[_dap_initialize "startup - initialize"] == ""} { return "" } - return [dap_check_request_and_response "startup - attach" attach \ - [format {o pid [i %s]} $pid]] + + set args [format {o pid [i %s]} $pid] + if {$prog != ""} { + append args [format { program [s %s]} $prog] + } + + return [dap_check_request_and_response "startup - attach" attach $args] } # Start gdb, send a DAP initialize request, and then an attach request |