aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.threads/create-fail.exp
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2012-07-20 17:27:29 +0000
committerPedro Alves <palves@redhat.com>2012-07-20 17:27:29 +0000
commit64776a0b2d88d40f308304194d26b766bb12b7e3 (patch)
treef320794b35f6aed58723c26ccbdd281a72d1edb0 /gdb/testsuite/gdb.threads/create-fail.exp
parent09826ec59df0c34fb49e483b88436b0ea0a7bb30 (diff)
downloadgdb-64776a0b2d88d40f308304194d26b766bb12b7e3.zip
gdb-64776a0b2d88d40f308304194d26b766bb12b7e3.tar.gz
gdb-64776a0b2d88d40f308304194d26b766bb12b7e3.tar.bz2
2012-07-20 Pedro Alves <palves@redhat.com>
PR threads/11692 PR gdb/12203 gdb/ * infrun.c (handle_inferior_event) <new thread>: Don't special case minus_one_ptid. <TARGET_WAITKIND_SPURIOUS>: Ditto. * linux-thread-db.c (thread_get_info_callback): Don't return early if the thread is zombie. (thread_from_lwp): Change return type to void. Rewrite stale comment. (attach_thread): Don't return early if the thread is zombie, instead set its "dying" flag. (thread_db_wait): Don't return TARGET_WAITKIND_SPURIOUS anymore. (find_new_threads_callback): Don't return early if the thread is zombie. gdb/testsuite/ * gdb.threads/create-fail.c: New file. * gdb.threads/create-fail.exp: New file.
Diffstat (limited to 'gdb/testsuite/gdb.threads/create-fail.exp')
-rw-r--r--gdb/testsuite/gdb.threads/create-fail.exp53
1 files changed, 53 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.threads/create-fail.exp b/gdb/testsuite/gdb.threads/create-fail.exp
new file mode 100644
index 0000000..0cdacf6
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/create-fail.exp
@@ -0,0 +1,53 @@
+# Copyright (C) 2012 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# On GNU/Linux, a creating a thread bound to an unexisting cpu spawns
+# the clone child thread for a bit, which is then immediately
+# cancelled. The spawned child may trigger a dlopen (for libgcc_s)
+# while being cancelled, which results in a trap being reported to
+# GDB, for a thread that libthread_db considers to be TD_THR_ZOMBIE.
+# Make sure we handle that scenario properly.
+
+standard_testfile
+set executable ${testfile}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ return -1
+}
+
+set iterations 10
+for {set i 1} {$i <= $iterations} {incr i} {
+ with_test_prefix "iteration $i" {
+
+ clean_restart ${executable}
+
+ if ![runto_main] {
+ return -1
+ }
+
+ set test "run till end"
+ gdb_test_multiple "continue" "$test" {
+ -re "exited with code 01.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "exited with code 02.*$gdb_prompt $" {
+ unsupported "$test (too many CPUs for test?)"
+ }
+ -re "exited normally.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ }
+}