old-cross-binutils/gdb/testsuite/gdb.threads/create-fail.exp
Pedro Alves 64776a0b2d 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.
2012-07-20 17:27:29 +00:00

53 lines
1.7 KiB
Text

# 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"
}
}
}
}