Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
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	[thread overview]
Message-ID: <1336050869-29605-13-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1336050869-29605-1-git-send-email-yao@codesourcery.com>

From: Pedro Alves <pedro@codesourcery.com>

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  <pedro@codesourcery.com>

	* 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


  parent reply	other threads:[~2012-05-03 13:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 13:12 [PATCH v4 0/14] Run all-stop on non-stop target Yao Qi
2012-05-03 13:12 ` [PATCH 03/14] Change parameters of adjust_pc_after_break Yao Qi
2012-05-03 13:12 ` [PATCH 01/14] Fix displaced stepping debug log Yao Qi
2012-05-03 15:01   ` Pedro Alves
2012-05-03 13:13 ` [PATCH 14/14] kfail gdb/13858 Yao Qi
2012-05-03 13:13 ` [PATCH 11/14] Fix fails in gdb.trace/pending.exp Yao Qi
2012-05-03 13:13 ` [PATCH 07/14] Support in remote target Yao Qi
2012-05-03 13:13 ` [PATCH 06/14] Flip to set target-async on by default and NEWS Yao Qi
2012-05-03 13:13 ` [PATCH 02/14] Move displaced_step_fixup bits out to displaced_step_next Yao Qi
2012-05-03 13:13 ` [PATCH 13/14] ia64-sigill.exp: Don't assume there's no infrun output after the prompt Yao Qi
2012-05-03 13:13 ` [PATCH 08/14] Uninstall infrun_async_inferior_event token in remote target Yao Qi
2012-05-03 13:13 ` [PATCH 09/14] Set thread's state in infcall Yao Qi
2012-05-03 13:13 ` Yao Qi [this message]
2012-05-03 13:13 ` [PATCH 05/14] Support in linux-nat target Yao Qi
2012-05-03 13:13 ` [PATCH 10/14] watchthreads-reorder.exp: Don't assume there is no infrun output after prompt Yao Qi
2012-05-03 13:14 ` [PATCH 04/14] Run all-stop on non-stop Yao Qi
2012-05-03 14:23 ` [PATCH v4 0/14] Run all-stop on non-stop target Pedro Alves
2012-05-03 14:38   ` Yao Qi
2012-05-09 17:46     ` Pedro Alves
2012-05-10 12:09       ` Yao Qi
2012-05-10 14:21         ` Pedro Alves
2012-05-26 11:08           ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1336050869-29605-13-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox