|
| 1 | +# Copyright (C) 2013 Free Software Foundation, Inc. |
| 2 | + |
| 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. |
| 7 | +# |
| 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. |
| 12 | +# |
| 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/>. */ |
| 15 | + |
| 16 | +set testfile tls-rhbz947564 |
| 17 | +set srcfile ${testfile}.cc |
| 18 | +set binfile [standard_output_file ${testfile}] |
| 19 | + |
| 20 | +if [istarget "*-*-linux"] then { |
| 21 | + set target_cflags "-D_MIT_POSIX_THREADS" |
| 22 | +} else { |
| 23 | + set target_cflags "" |
| 24 | +} |
| 25 | + |
| 26 | +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list c++ debug]] != "" } { |
| 27 | + return -1 |
| 28 | +} |
| 29 | + |
| 30 | +gdb_exit |
| 31 | +gdb_start |
| 32 | +gdb_reinitialize_dir $srcdir/$subdir |
| 33 | + |
| 34 | +gdb_load ${binfile} |
| 35 | + |
| 36 | +if { ![runto_main] } { |
| 37 | + fail "Can't run to function main" |
| 38 | + return 0 |
| 39 | +} |
| 40 | + |
| 41 | +gdb_breakpoint "foo" |
| 42 | +gdb_continue_to_breakpoint "foo" ".* foo_marker .*" |
| 43 | + |
| 44 | +proc get_xp_val {try} { |
| 45 | + global expect_out |
| 46 | + global gdb_prompt |
| 47 | + global hex |
| 48 | + |
| 49 | + set xp_val "" |
| 50 | + gdb_test_multiple "print *yp" "print yp value" { |
| 51 | + -re { = \{v = 0, static xp = (0x[0-9a-f]+)\}.* } { |
| 52 | + pass "print $try value of *yp" |
| 53 | + set xp_val $expect_out(1,string) |
| 54 | + } |
| 55 | + -re "$gdb_prompt $" { |
| 56 | + fail "print $try value of *yp" |
| 57 | + } |
| 58 | + timeout { |
| 59 | + fail "print $try value of *yp (timeout)" |
| 60 | + } |
| 61 | + } |
| 62 | + return $xp_val |
| 63 | +} |
| 64 | + |
| 65 | +set first_run [get_xp_val "first"] |
| 66 | + |
| 67 | +gdb_test "continue" "Breakpoint \[0-9\]+, foo \\\(yp=$hex\\\) at.*" |
| 68 | + |
| 69 | +set second_run [get_xp_val "second"] |
| 70 | + |
| 71 | +if { $first_run != $second_run } { |
| 72 | + pass "different values for TLS variable" |
| 73 | +} else { |
| 74 | + fail "different values for TLS variable" |
| 75 | +} |
0 commit comments