From: Maciej W. Rozycki Date: Tue, 9 Sep 2014 15:06:15 +0000 (+0100) Subject: GDB/testsuite: Extend the time gdbserver is waited for X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2bdd10b78e7e5b33c488af6fcb01255269e8a498;p=binutils-gdb.git GDB/testsuite: Extend the time gdbserver is waited for Gdbserver support code uses the global timeout value to determine when to stop waiting for a gdbserver process being started to respond before continuing anyway. This timeout is usually as low as 10s and may not be enough in this context, for example on the first run where the filesystem cache is cold, even if it is elsewhere. E.g. I observe this reliably with gdbserver started the first time in QEMU running in the system emulation mode: (gdb) file .../gdb.base/advance Reading symbols from .../gdb.base/advance...done. (gdb) delete breakpoints (gdb) info breakpoints No breakpoints or watchpoints. (gdb) break main Breakpoint 1 at 0x87f8: file .../gdb.base/advance.c, line 41. (gdb) set remotetimeout 15 (gdb) kill The program is not being run. (gdb) [...] .../bin/gdbserver --once :6014 advance target remote localhost:6014 Remote debugging using localhost:6014 Remote communication error. Target disconnected.: Connection reset by peer. (gdb) continue The program is not being run. (gdb) Process advance created; pid = 999 Listening on port 6014 FAIL: gdb.base/advance.exp: Can't run to main -- notice how the test harness proceeded with the `target remote ...' command even though gdbserver hasn't completed its startup yet. A while later when it's finally ready it's too late already. I checked the timing here and it takes gdbserver roughly 25 seconds to start in this scenario. Subsequent gdbserver starts in the same test run take less time and usually complete within 10 seconds although occasionally `target remote ...' precedes the corresponding `Listening on port...' message again. Therefore I have fixed this problem by setting an explicit timeout to 120s on the expect call in question. If this turns out too arbitrary sometime, then perhaps a separate `gdbserver_timeout' setting might be due. * lib/gdbserver-support.exp (gdbserver_start): Set timeout to 120 on waiting for the TCP socket to open. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3fc26805a86..4d2933c4e1c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-09 Maciej W. Rozycki + + * lib/gdbserver-support.exp (gdbserver_start): Set timeout to + 120 on waiting for the TCP socket to open. + 2014-09-09 Doug Evans * gdb.base/default.exp (show_conv_list): Add _caller_is, diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp index 8c91e281f22..e3cae631b1e 100644 --- a/gdb/testsuite/lib/gdbserver-support.exp +++ b/gdb/testsuite/lib/gdbserver-support.exp @@ -275,6 +275,7 @@ proc gdbserver_start { options arguments } { # Wait for the server to open its TCP socket, so that GDB can connect. expect { -i $server_spawn_id + -timeout 120 -notransfer -re "Listening on" { } -re "Can't bind address: Address already in use\\.\r\n" {