From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19051 invoked by alias); 28 Nov 2011 15:45:02 -0000 Received: (qmail 18945 invoked by uid 22791); 28 Nov 2011 15:44:59 -0000 X-SWARE-Spam-Status: No, hits=4.2 required=5.0 tests=AWL,BAYES_00,BOTNET,FROM_12LTRDOM,RDNS_DYNAMIC X-Spam-Check-By: sourceware.org Received: from bl22-166-20.dsl.telepac.pt (HELO localhost6.localdomain6) (2.83.166.20) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Nov 2011 15:44:45 +0000 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id pASFeEm0018127 for ; Mon, 28 Nov 2011 15:40:14 GMT Subject: [RFC/WIP PATCH 14/14] Fix manythreads.exp test To: gdb-patches@sourceware.org From: Pedro Alves Date: Mon, 28 Nov 2011 15:45:00 -0000 Message-ID: <20111128154014.17761.68756.stgit@localhost6.localdomain6> In-Reply-To: <20111128153742.17761.21459.stgit@localhost6.localdomain6> References: <20111128153742.17761.21459.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-11/txt/msg00772.txt.bz2 As infrun only decides to stop or not all threads after handling the event the target reported, threads can now appear or disappear after "Program received signal SIGFOO" and presenting the prompt, which breaks the manythreads.exp test. This fixes it. --- gdb/testsuite/gdb.threads/manythreads.exp | 52 +++++++++++++++++++++++------ 1 files changed, 41 insertions(+), 11 deletions(-) diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp index 12a25b9..168beac 100644 --- a/gdb/testsuite/gdb.threads/manythreads.exp +++ b/gdb/testsuite/gdb.threads/manythreads.exp @@ -112,10 +112,39 @@ gdb_test_multiple "continue" "second continue" { } } +# Note that in the tests below, we can't suffix the "Program received +# signal SIGINT" regexes with $gdb_prompt, as doing so would mean that +# e.g. with, +# +# Program received signal SIGINT, Interrupt. +# [New Thread FOO] +# [Switching to Thread BAR] +# 0xdeadbeef in bar () from bar.so +# (gdb) +# +# the [New ...] or [... exited] regexes would eat the "Program +# received ..." bit. [New FOO] and [FOO exited] may appear while GDB +# is stopping threads. + # Wait another second. If the program stops on its own, GDB has failed # to handle duplicate SIGINTs sent to multiple threads. set failed 0 remote_expect host 1 { + -re "Program received signal SIGINT" { + + # Eat the prompt. + gdb_expect { + -re "$gdb_prompt $" { + } + } + + if { $failed == 0 } { + fail "check for duplicate SIGINT" + } + send_gdb "continue\n" + set failed 1 + exp_continue + } -re "\\\[New \[^\]\]*\\\]\r\n" { exp_continue -continue_timer } @@ -125,14 +154,6 @@ remote_expect host 1 { -re "Thread \[^\n\]* executing\r\n" { exp_continue -continue_timer } - -re "Program received signal SIGINT.*$gdb_prompt $" { - if { $failed == 0 } { - fail "check for duplicate SIGINT" - } - send_gdb "continue\n" - set failed 1 - exp_continue - } timeout { if { $failed == 0 } { pass "check for duplicate SIGINT" @@ -144,6 +165,18 @@ remote_expect host 1 { send_gdb "\003" set message "stop threads 2" gdb_test_multiple "" "stop threads 2" { + -re "Program received signal SIGINT" { + + # Eat the prompt. + gdb_expect { + -re "$gdb_prompt $" { + pass "$message" + } + timeout { + fail "$message (timeout)" + } + } + } -re "\\\[New \[^\]\]*\\\]\r\n" { exp_continue } @@ -153,9 +186,6 @@ gdb_test_multiple "" "stop threads 2" { -re "Thread \[^\n\]* executing\r\n" { exp_continue } - -re "Program received signal SIGINT.*$gdb_prompt $" { - pass "$message" - } timeout { fail "$message (timeout)" }