From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8360 invoked by alias); 4 Apr 2005 04:21:40 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 8291 invoked from network); 4 Apr 2005 04:21:32 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 4 Apr 2005 04:21:32 -0000 Received: from drow by nevyn.them.org with local (Exim 4.50 #1 (Debian)) id 1DIJ5f-0002HM-Oy; Mon, 04 Apr 2005 00:21:31 -0400 Date: Mon, 04 Apr 2005 04:21:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Cc: Michael Snyder Subject: [rfa/threads test] Check for SIGINT handling in manythreads.exp Message-ID: <20050404042131.GA8509@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com, Michael Snyder Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.8i X-SW-Source: 2005-04/txt/msg00043.txt.bz2 The intermittent failure of this test using LinuxThreads puzzled me for a while. It looked like this: (gdb) continue Continuing. [expect sends ^C] (gdb) Quit (gdb) FAIL: Now where'd that prompt come from? Turns out using after for delays isn't such a good idea. We lose inferior output while sleeping. Same thing for "exec sleep 1". But if we use gdb_expect, we can see what's going on: a second copy of the previous SIGINT arrived after the continue command. So GDB was already stopped when the ^C was sent, thus the Quit message. This patch updates the testcase so that the log shows what's going on, and adds an explicit test that we don't get duplicate signals. With my previous patch from today, the test passes. OK? -- Daniel Jacobowitz CodeSourcery, LLC 2005-04-04 Daniel Jacobowitz * gdb.threads/manythreads.exp: Use gdb_expect instead of after. Add a test for duplicated SIGINTs. Index: testsuite/gdb.threads/manythreads.exp =================================================================== RCS file: /big/fsf/rsync/src-cvs/src/gdb/testsuite/gdb.threads/manythreads.exp,v retrieving revision 1.2 diff -u -p -r1.2 manythreads.exp --- testsuite/gdb.threads/manythreads.exp 3 Jun 2004 22:10:56 -0000 1.2 +++ testsuite/gdb.threads/manythreads.exp 4 Apr 2005 04:18:00 -0000 @@ -1,5 +1,5 @@ # manythreads.exp -- Expect script to test stopping many threads -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -59,8 +59,11 @@ gdb_test_multiple "continue" "first cont } } +# Wait one second. This is better than the TCL "after" command, because +# we don't lose GDB's output while we do it. +gdb_expect 1 { timeout { } } + # Send a Ctrl-C and verify that we can do info threads and continue -after 1000 send_gdb "\003" set message "stop threads 1" gdb_test_multiple "" "stop threads 1" { @@ -93,8 +96,35 @@ gdb_test_multiple "continue" "second con } } +# Wait another second. If the program stops on its own, GDB has failed +# to handle duplicate SIGINTs sent to multiple threads. +set failed 0 +gdb_expect 1 { + -re "\\\[New \[^\]\]*\\\]\r\n" { + exp_continue -continue_timer + } + -re "\\\[\[^\]\]* exited\\\]\r\n" { + exp_continue -continue_timer + } + -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" + } + } +} + # Send another Ctrl-C and verify that we can do info threads and quit -after 1000 send_gdb "\003" set message "stop threads 2" gdb_test_multiple "" "stop threads 2" {