aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2021-03-19 11:07:11 -0700
committerKevin Buettner <kevinb@redhat.com>2021-03-19 13:36:33 -0700
commite0d6d274068b02d952852b18adb3feaca1d2bb8a (patch)
treee876301d4ac47684a08638b134ce6af3fa370e88 /gdb/testsuite
parent219f56b4842f4e72540082af96e47efa0f0f0a82 (diff)
downloadgdb-e0d6d274068b02d952852b18adb3feaca1d2bb8a.zip
gdb-e0d6d274068b02d952852b18adb3feaca1d2bb8a.tar.gz
gdb-e0d6d274068b02d952852b18adb3feaca1d2bb8a.tar.bz2
Fix potential hang during gdbserver testing
We're currently seeing testing of native-extended-gdbserver hang while testing the x86_64 architecture on both Fedora 34 and Fedora Rawhide. The test responsible for the hang is gdb.threads/fork-plus-threads.exp. While there is clearly a problem/bug with this test on F34 and Rawhide, it's also the case that testing should not hang. This commit prevents the hang by waiting with the "-nowait" flag in close_gdbserver. The -nowait flag is also used in the kill_wait_spawned_process proc in gdb/testsuite/lib/gdb.exp, so there is precedent for doing this. There are also 15 other uses of "wait -i" scattered throughout the test suite. While it's tempting to change these to also use the -nowait flag, I think it might be safer to defer doing so until we actually see a problem. I've tested this patch on Fedora 32, 33, 34, and Rawhide. Results are comparable on Fedora 32 and 33. On Fedora 34 and Rawhide, with this commit in place, testing completes when the target_board is native-extended-gdbserver. On those OSes, when not using this commit, testing usually hangs due to a problem with gdb.threads/fork-plus-threads.exp. I've also tested on all of the mentioned OSes with target_board=native-gdbserver; for that testing, I achieved comparable results over a number of runs. (Unfortunately results are rarely identical due to racy tests.) gdb/testsuite/ChangeLog: * lib/gdbserver-support.exp (gdbserver_exit): Use the "-nowait" flag when waiting for gdbserver to exit.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/lib/gdbserver-support.exp7
2 files changed, 11 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 42484fa..d5ff002 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-19 Kevin Buettner <kevinb@redhat.com>
+
+ * lib/gdbserver-support.exp (gdbserver_exit): Use the
+ "-nowait" flag when waiting for gdbserver to exit.
+
2021-03-19 Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
* gdb.base/info-macros.exp: Append -fdebug-macro to
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index 7b48b5a..0886634 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -421,7 +421,12 @@ proc close_gdbserver {} {
verbose "Quitting GDBserver"
catch "close -i $server_spawn_id"
- catch "wait -i $server_spawn_id"
+
+ # If gdbserver misbehaves, and ignores the close, waiting for it
+ # without the -nowait flag will cause testing to hang. Passing
+ # -nowait makes expect tell Tcl to wait for the process in the
+ # background.
+ catch "wait -nowait -i $server_spawn_id"
unset server_spawn_id
}