From patchwork Mon Jul 28 19:34:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 2199 Received: (qmail 5054 invoked by alias); 28 Jul 2014 19:34:45 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5037 invoked by uid 89); 28 Jul 2014 19:34:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 28 Jul 2014 19:34:42 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1XBqgx-0005Et-Ja from Maciej_Rozycki@mentor.com for gdb-patches@sourceware.org; Mon, 28 Jul 2014 12:34:39 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 28 Jul 2014 12:34:39 -0700 Received: from localhost (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server (TLS) id 14.2.247.3; Mon, 28 Jul 2014 20:34:37 +0100 Date: Mon, 28 Jul 2014 20:34:33 +0100 From: "Maciej W. Rozycki" To: Subject: [PATCH] GDB/testsuite: Extend the time gdbserver is waited for Message-ID: User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Hi, 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. Tested with arm-linux-gnueabi and mips-linux-gnu. OK to apply? 2014-07-28 Maciej W. Rozycki gdb/testsuite/ * lib/gdbserver-support.exp (gdbserver_start): Set timeout to 120 on waiting for the TCP socket to open. Maciej gdb-test-gdbserver-start-timeout.diff Index: gdb-fsf-trunk-quilt/gdb/testsuite/lib/gdbserver-support.exp =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/testsuite/lib/gdbserver-support.exp 2014-05-13 02:52:11.347706187 +0100 +++ gdb-fsf-trunk-quilt/gdb/testsuite/lib/gdbserver-support.exp 2014-05-30 01:45:51.658977074 +0100 @@ -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" {