summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-05-15 15:54:36 +0100
committerMaciej W. Rozycki <macro@mips.com>2018-05-15 15:54:36 +0100
commit0726fcc61a8b7c943de513ec598b2189c5f67715 (patch)
treeb304877969c2e1a49112224ba8bd551962af7192
parent810ed4db984d378ca9c8e3d152966fb81c23ef95 (diff)
downloadbinutils-gdb-0726fcc61a8b7c943de513ec598b2189c5f67715.tar.gz
testsuite: Fix a `server_pid' access crash in gdb.server/server-kill.exp
Fix a commit f90183d7e31b ("Get GDBserver pid on remote target") bug and correctly handle the case where the PID of `gdbserver' could not have been retrieved. If that happens, $server_pid is unset causing: FAIL: gdb.server/server-kill.exp: p server_pid ERROR: tcl error sourcing .../gdb/testsuite/gdb.server/server-kill.exp. ERROR: can't read "server_pid": no such variable while executing "if {$server_pid == "" } { return -1 }" (file ".../gdb/testsuite/gdb.server/server-kill.exp" line 49) invoked from within "source .../gdb/testsuite/gdb.server/server-kill.exp" ("uplevel" body line 1) invoked from within "uplevel #0 source .../gdb/testsuite/gdb.server/server-kill.exp" invoked from within "catch "uplevel #0 source $test_file_name"" Verify that the variable exists then rather than trying to access it. gdb/testsuite/ * gdb.server/server-kill.exp: Verify whether `server_pid' exists rather then trying to access it in determining whether the PID of `gdbserver' could have been retrieved.
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.server/server-kill.exp2
2 files changed, 7 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9fc54c0001c..b18d4b6743e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-15 Maciej W. Rozycki <macro@mips.com>
+
+ * gdb.server/server-kill.exp: Verify whether `server_pid' exists
+ rather then trying to access it in determining whether the PID
+ of `gdbserver' could have been retrieved.
+
2018-05-08 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.arch/amd64-init-x87-values.S: New file.
diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp
index 0701d5fe40a..c110f3a50a0 100644
--- a/gdb/testsuite/gdb.server/server-kill.exp
+++ b/gdb/testsuite/gdb.server/server-kill.exp
@@ -46,7 +46,7 @@ gdb_test_multiple $test $test {
}
}
-if {$server_pid == "" } {
+if ![info exists server_pid] {
return -1
}