1 # Copyright 2011-2024 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/>.
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 require dwarf2_support
24 # This test can only be run on x86-64 targets.
25 require is_x86_64_m64_target
27 if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S \
28 {nodebug nopie additional_flags=-nostdlib}] } {
36 # Initialize tests to be an empty array.
37 unset -nocomplain tests
40 proc gdb-test {line var value} {
43 lappend tests($line) [list $var $value 0]
46 proc xfail-gdb-test {line var value} {
49 lappend tests($line) [list $var $value 1]
52 proc scan_gdb_tests {} {
53 global srcdir subdir test
55 set file "$srcdir/$subdir/$test.c"
60 if {! [regexp "\{ (gdb-test .+) \} \}" $line ignore test_cmd]} {
71 foreach line [lsort [array names tests]] {
72 gdb_test "break ${test}.c:$line" "Breakpoint .*" \
73 "set breakpoint at ${test}.c:$line"
74 gdb_continue_to_breakpoint "continue to ${test}.c:$line"
76 foreach testvec $tests($line) {
77 set var [lindex $testvec 0]
78 set value [lindex $testvec 1]
79 set should_xfail [lindex $testvec 2]
85 gdb_test "print $var" \
87 "check value of $var at ${test}.c:$line"