From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20013 invoked by alias); 17 Dec 2011 02:59:42 -0000 Received: (qmail 19891 invoked by uid 22791); 17 Dec 2011 02:59:41 -0000 X-SWARE-Spam-Status: Yes, hits=6.1 required=5.0 tests=AWL,BAYES_00,BOTNET,FROM_12LTRDOM,RCVD_IN_BRBL_LASTEXT,RDNS_DYNAMIC X-Spam-Check-By: sourceware.org Received: from bl16-10-144.dsl.telepac.pt (HELO localhost6.localdomain6) (188.81.10.144) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Dec 2011 02:59:28 +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 pBH2xL9M022638 for ; Sat, 17 Dec 2011 02:59:21 GMT Subject: [RFC/WIP PATCH v2 03/12] manythreads.exp: Adjust to handle threads appearing/disappearing after "Program received signal SIGFOO" To: gdb-patches@sourceware.org From: Pedro Alves Date: Sat, 17 Dec 2011 02:59:00 -0000 Message-ID: <20111217025921.22456.93229.stgit@localhost6.localdomain6> In-Reply-To: <20111217025904.22456.50717.stgit@localhost6.localdomain6> References: <20111217025904.22456.50717.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-12/txt/msg00553.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. v2: - "stop threads 1" test needed adjustment too. gdb/testsuite/ 2011-12-16 Pedro Alves * gdb.threads/manythreads.exp: Don't assume threads can't appear or disappear after printing "Program received signal ". --- gdb/testsuite/gdb.threads/manythreads.exp | 68 +++++++++++++++++++++++------ 1 files changed, 54 insertions(+), 14 deletions(-) diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp index 12a25b9..a027309 100644 --- a/gdb/testsuite/gdb.threads/manythreads.exp +++ b/gdb/testsuite/gdb.threads/manythreads.exp @@ -54,6 +54,22 @@ gdb_test_multiple "continue" "first 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 one second. This is better than the TCL "after" command, because # we don't lose GDB's output while we do it. remote_expect host 1 { timeout { } } @@ -62,6 +78,17 @@ remote_expect host 1 { timeout { } } send_gdb "\003" set message "stop threads 1" gdb_test_multiple "" "stop threads 1" { + -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 } @@ -71,9 +98,6 @@ gdb_test_multiple "" "stop threads 1" { -re "Thread \[^\n\]* executing\r\n" { exp_continue } - -re "Program received signal SIGINT.*$gdb_prompt $" { - pass "$message" - } timeout { fail "$message (timeout)" } @@ -116,6 +140,21 @@ gdb_test_multiple "continue" "second continue" { # 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 +164,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 +175,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 +196,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)" }