gdbserver_spawn "" rather than gdbserver_spawn ${binfile}
authorYao Qi <yao.qi@linaro.org>
Tue, 23 Aug 2016 13:24:03 +0000 (14:24 +0100)
committerYao Qi <yao.qi@linaro.org>
Tue, 23 Aug 2016 13:24:03 +0000 (14:24 +0100)
Hi,
I happen to see gdbserver is spawned like this in gdb.log,

spawn /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2346 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.s
erver/connect-stopped-target/connect-stopped-target /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/connect-stopped-target/connect-stopped-t
arget

spawn /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.s
erver/connect-stopped-target/connect-stopped-target /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/connect-stopped-target/connect-stopped-t
arget

as we can see, there are two instances of connect-stopped-target or
connect-stopped-target in the command line spawning gdbserver, but
none of these gets parameters from command line.  In these two
tests, gdbserver is spawned via "gdbserver_spawn ${binfile}".  However,
the argument of gdbserver_spawn is the argument passed the child
inferior, not the program itself.

 # Start a gdbserver process running SERVER_EXEC, and connect GDB
 # to it.  CHILD_ARGS are passed to the inferior.
 #
 # Returns the target protocol and socket to connect to.

proc gdbserver_spawn { child_args } {
    set target_exec [gdbserver_download_current_prog]

GDBserver gets the program via last_loaded_file, which is set by
gdb_file_cmd.  In each test, we don't need to pass ${binfile}.

gdb/testsuite:

2016-08-23  Yao Qi  <yao.qi@linaro.org>

* gdb.server/connect-stopped-target.exp (do_test): Pass "" to
gdbserver_spawn.
* gdb.server/connect-without-multi-process.exp (do_test):
Likewise.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.server/connect-stopped-target.exp
gdb/testsuite/gdb.server/connect-without-multi-process.exp

index 76f57e13c4603ba6b205a2ccc4530a2e67c9ac31..4fd53449d782e7ed8954906f518c376e7e8d0d82 100644 (file)
@@ -1,3 +1,10 @@
+2016-08-23  Yao Qi  <yao.qi@linaro.org>
+
+       * gdb.server/connect-stopped-target.exp (do_test): Pass "" to
+       gdbserver_spawn.
+       * gdb.server/connect-without-multi-process.exp (do_test):
+       Likewise.
+
 2016-08-23  Yao Qi  <yao.qi@linaro.org>
 
        * gdb.base/signals-state-child.exp: Set variables gdb_txt and
index b083d899c7e22699b9a9cf682d5a60fcc82d768e..9e445b041d0770945da34369214bf359151781e1 100644 (file)
@@ -44,7 +44,7 @@ proc do_test {nonstop} {
 
     gdb_test "set non-stop $nonstop"
 
-    set res [gdbserver_spawn ${binfile}]
+    set res [gdbserver_spawn ""]
     set gdbserver_protocol [lindex $res 0]
     set gdbserver_gdbport [lindex $res 1]
 
index 79d7d72699cae870ed2602cf4d2d9810b6337cc4..2e9769bec630ea90b2f45a2f6e25e01d820d04fd 100644 (file)
@@ -41,7 +41,7 @@ proc do_test {multiprocess} {
 
     gdb_test_no_output "set remote multiprocess-feature $multiprocess"
 
-    set res [gdbserver_spawn ${binfile}]
+    set res [gdbserver_spawn ""]
     set gdbserver_protocol [lindex $res 0]
     set gdbserver_gdbport [lindex $res 1]