1 # Copyright 2017-2020 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/>.
18 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
19 executable { debug }] != "" } {
23 # Generate a native core file.
25 set corefile [core_find $binfile]
26 set core_supported [expr {$corefile != ""}]
28 # Generate a core file with "gcore".
30 clean_restart ${binfile}
34 set gcorefile [standard_output_file gcore.test]
35 set gcore_supported [gdb_gcore_cmd "$gcorefile" "gcore"]
37 # Restart gdb and load COREFILE as a core file. SUPPORTED is true iff
38 # the core was generated successfully; otherwise, the tests are marked
41 proc tls_core_test {supported corefile} {
42 upvar target_triplet target_triplet
43 upvar host_triplet host_triplet
46 clean_restart ${binfile}
48 set test "load core file"
50 set core_loaded [gdb_core_cmd $corefile $test]
56 set test "print thread-local storage variable"
57 if { $core_loaded == 1 } {
58 # This fails in cross-debugging due to the use of native
60 if {![string match $host_triplet $target_triplet]} {
61 setup_kfail "threads/22381" "*-*-*"
63 gdb_test "p/x foo" "\\$\[0-9]+ = 0xdeadbeef" $test
69 with_test_prefix "native" {
70 tls_core_test $core_supported $corefile
73 with_test_prefix "gcore" {
74 tls_core_test $gcore_supported $gcorefile