From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1988 invoked by alias); 3 May 2012 13:13:19 -0000 Received: (qmail 1838 invoked by uid 22791); 3 May 2012 13:13:16 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 May 2012 13:13:01 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SPvq7-0005Ng-Rh from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 03 May 2012 06:12:59 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 3 May 2012 06:12:53 -0700 Received: from localhost.localdomain (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.1.289.1; Thu, 3 May 2012 06:12:50 -0700 From: Yao Qi To: Subject: [PATCH 12/14] manythreads.exp: Adjust to handle threads appearing/disappearing after "Program received signal SIGFOO" Date: Thu, 03 May 2012 13:13:00 -0000 Message-ID: <1336050869-29605-13-git-send-email-yao@codesourcery.com> In-Reply-To: <1336050869-29605-1-git-send-email-yao@codesourcery.com> References: <1336050869-29605-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain 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: 2012-05/txt/msg00073.txt.bz2 From: Pedro Alves 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 42333e6..83d1a9b 100644 --- a/gdb/testsuite/gdb.threads/manythreads.exp +++ b/gdb/testsuite/gdb.threads/manythreads.exp @@ -49,6 +49,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 { } } @@ -57,6 +73,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 } @@ -66,9 +93,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)" } @@ -111,6 +135,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 } @@ -120,14 +159,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" @@ -139,6 +170,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 } @@ -148,9 +191,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)" } -- 1.7.0.4