Automatic date update in version.in
[binutils-gdb/blckswan.git] / gdb / testsuite / gdb.threads / create-fail.exp
blob664d9415d832c4c91c59f794a7410dc926426247
1 # Copyright (C) 2012-2022 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 # On GNU/Linux, a creating a thread bound to an unexisting cpu spawns
17 # the clone child thread for a bit, which is then immediately
18 # cancelled.  The spawned child may trigger a dlopen (for libgcc_s)
19 # while being cancelled, which results in a trap being reported to
20 # GDB, for a thread that libthread_db considers to be TD_THR_ZOMBIE.
21 # Make sure we handle that scenario properly.
23 standard_testfile
24 set executable ${testfile}
26 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
27     return -1
30 set iterations 10
31 for {set i 1} {$i <= $iterations} {incr i} {
32     with_test_prefix "iteration $i" {
34         clean_restart ${executable}
36         if ![runto_main] {
37             return -1
38         }
40         set test "run till end"
41         gdb_test_multiple "continue" "$test" {
42             -re "exited with code 01.*$gdb_prompt $" {
43                 pass "$test"
44             }
45             -re "exited with code 02.*$gdb_prompt $" {
46                 unsupported "$test (too many CPUs for test?)"
47             }
48             -re "exited normally.*$gdb_prompt $" {
49                 pass "$test"
50             }
51         }
52     }