]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/clztest.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / clztest.exp
1 # Copyright 2011-2024 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 load_lib dwarf.exp
17
18 standard_testfile .S
19 set test "clztest"
20
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 require dwarf2_support
23
24 # This test can only be run on x86-64 targets.
25 require is_x86_64_m64_target
26
27 if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S \
28 {nodebug nopie additional_flags=-nostdlib}] } {
29 return -1
30 }
31
32 if ![runto_main] {
33 return -1
34 }
35
36 # Initialize tests to be an empty array.
37 unset -nocomplain tests
38 array set tests {}
39
40 proc gdb-test {line var value} {
41 global tests
42
43 lappend tests($line) [list $var $value 0]
44 }
45
46 proc xfail-gdb-test {line var value} {
47 global tests
48
49 lappend tests($line) [list $var $value 1]
50 }
51
52 proc scan_gdb_tests {} {
53 global srcdir subdir test
54
55 set file "$srcdir/$subdir/$test.c"
56
57 set fd [open "$file"]
58 while {![eof $fd]} {
59 set line [gets $fd]
60 if {! [regexp "\{ (gdb-test .+) \} \}" $line ignore test_cmd]} {
61 continue
62 }
63
64 eval $test_cmd
65 }
66 close $fd
67 }
68
69 scan_gdb_tests
70
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"
75
76 foreach testvec $tests($line) {
77 set var [lindex $testvec 0]
78 set value [lindex $testvec 1]
79 set should_xfail [lindex $testvec 2]
80
81 if {$should_xfail} {
82 setup_xfail *-*-*
83 }
84
85 gdb_test "print $var" \
86 " = $value" \
87 "check value of $var at ${test}.c:$line"
88 }
89 }