Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.cp / temargs.exp
blobe715f2b4a9d1b9229fc3914516751521e5a60da4
1 # temargs.exp - Template argument tests
3 # Copyright 2010-2024 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 # This file is part of the gdb testsuite.
20 require allow_cplus_tests
22 standard_testfile .cc
24 if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
25          {debug c++ additional_flags=-std=c++11}]} {
26     return -1
29 if {![runto_main]} {
30     return -1
33 # gcc 4.4 and earlier don't emit enough info for some of our template tests.
34 set have_older_template_gcc 0
35 set have_pr_41736_fixed 1
36 set have_pr_45024_fixed 1
37 if {[test_compiler_info {gcc-[0-3]-*}]
38     || [test_compiler_info {gcc-4-[0-4]-*}]} {
39     set have_older_template_gcc 1
40     set have_pr_41736_fixed 0
41     set have_pr_45024_fixed 0
42 } elseif {[test_compiler_info {gcc-4-5-*}]} {
43     set have_pr_41736_fixed 0
44     set have_pr_45024_fixed 0
47 set using_gcc [test_compiler_info gcc-*-*]
49 set line [gdb_get_line_number "Breakpoint 1" $srcfile]
50 gdb_test "break $srcfile:$line" "Breakpoint 2.*" \
51     "set first breakpoint for temargs"
53 set line [gdb_get_line_number "Breakpoint 2" $srcfile]
54 gdb_test "break $srcfile:$line" "Breakpoint 3.*" \
55     "set second breakpoint for temargs"
57 set line [gdb_get_line_number "Breakpoint 3" $srcfile]
58 gdb_test "break $srcfile:$line" "Breakpoint 4.*" \
59     "set third breakpoint for temargs"
61 set line [gdb_get_line_number "Breakpoint 4" $srcfile]
62 gdb_test "break $srcfile:$line" "Breakpoint 5.*" \
63     "set fourth breakpoint for temargs"
65 set line [gdb_get_line_number "Breakpoint 5" $srcfile]
66 gdb_test "break $srcfile:$line" "Breakpoint 6.*" \
67     "set fifth breakpoint for temargs"
69 set line [gdb_get_line_number "Breakpoint 6" $srcfile]
70 gdb_test "break $srcfile:$line" "Breakpoint 7.*" \
71     "set sixth breakpoint for temargs"
74 # Tests in Base::base_m.
77 gdb_continue_to_breakpoint "continue to first breakpoint for temargs"
79 if $have_older_template_gcc { setup_xfail "*-*-*" }
80 gdb_test "ptype T" "double" "test type of T in base_m"
82 if $have_older_template_gcc { setup_xfail "*-*-*" }
83 gdb_test "print I" " = 23" "test value of I in base_m"
85 if $have_older_template_gcc { setup_xfail "*-*-*" }
86 gdb_test "print P == &a_global" " = true" "test value of P in base_m"
88 if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
89 gdb_test "print MP" "&S::f" "test value of MP in base_m"
92 # Tests in Inner::inner_m.
95 gdb_continue_to_breakpoint "continue to second breakpoint for temargs"
98 if {!$have_pr_45024_fixed} { setup_xfail *-*-* }
99 gdb_test "ptype T" "long" "test type of T in inner_m"
101 if {!$have_pr_45024_fixed} { setup_xfail *-*-* }
102 gdb_test "print I" " = 47" "test value of I in inner_m"
104 if $have_older_template_gcc { setup_xfail "*-*-*"
105 } elseif {[test_compiler_info {gcc-[0-3]-*}]
106          || [test_compiler_info {gcc-4-[0-5]-*}]} {
107   # gcc-4.5.x still does not emit inner DW_TAG_structure_type.
108   setup_xfail "*-*-*"
110 gdb_test "print P == &a_global" " = true" "test value of P in inner_m"
112 if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
113 gdb_test "print MP" "&S::f" "test value of MP in inner_m"
115 if $have_older_template_gcc { setup_xfail "*-*-*"
116 } elseif {[test_compiler_info {gcc-[0-3]-*}]
117          || [test_compiler_info {gcc-4-[0-5]-*}]} {
118   # gcc-4.5.x still does not emit outer DW_TAG_structure_type.
119   setup_xfail "*-*-*"
121 gdb_test "whatis Z" "float" "test type of Z in inner_m"
124 # Tests in func.
127 gdb_continue_to_breakpoint "continue to third breakpoint for temargs"
129 if $have_older_template_gcc { setup_xfail "*-*-*" }
130 gdb_test "ptype T" "unsigned char" "test type of T in func"
132 if $have_older_template_gcc { setup_xfail "*-*-*" }
133 gdb_test "print I" " = 91" "test value of I in func"
135 # PR symtab/16842 - gdb used to crash here.
136 if $have_older_template_gcc { setup_xfail "*-*-*" }
137 gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in func"
139 if $have_older_template_gcc { setup_xfail "*-*-*" }
140 gdb_test "print P == &a_global" " = true" "test value of P in func"
142 if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
143 gdb_test "print MP" "&S::f" "test value of MP in func"
146 # Tests in Base::templ_m.
149 gdb_continue_to_breakpoint "continue to fourth breakpoint for temargs"
151 if $have_older_template_gcc { setup_xfail "*-*-*" }
152 gdb_test "ptype T" "double" "test type of T in templ_m"
154 if $have_older_template_gcc { setup_xfail "*-*-*" }
155 gdb_test "print I" " = 23" "test value of I in templ_m"
157 # PR symtab/16842 - gdb used to crash here.
158 if $have_older_template_gcc { setup_xfail "*-*-*" }
159 gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in templ_m"
161 if $have_older_template_gcc { setup_xfail "*-*-*" }
162 gdb_test "print P == &a_global" " = true" "test value of P in templ_m"
164 if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
165 gdb_test "print MP" "&S::f" "test value of MP in templ_m"
167 if $have_older_template_gcc { setup_xfail "*-*-*" }
168 gdb_test "whatis Q" "short" "test type of Q in templ_m"
171 # Tests in K2::k2_m.
174 gdb_continue_to_breakpoint "continue to fifth breakpoint for temargs"
176 if $have_older_template_gcc { setup_xfail "*-*-*" }
177 gdb_test "ptype F" "type = void \\\(S::\\\*\\\)\\\(S \\\* const\\\)" \
178     "test type of F in k2_m"
180 setup_xfail gcc/49366 "*-*-*"
181 gdb_test "print F" "&S::somefunc" "test value of F in k2_m"
184 # Tests in K3::k3_m, GCC PR debug/49546.
185 # The problem reproduces with DW_AT_MIPS_linkage_name.  It does not happen with
186 # GDB physname - GDB's own computation of the linkage name based on
187 # (incorrectly output by GCC) DW_AT_name.
190 gdb_continue_to_breakpoint "continue to sixth breakpoint for temargs"
192 if $have_older_template_gcc { setup_xfail "*-*-*"
193 } elseif { $using_gcc } { setup_xfail gcc/49546 "*-*-*" }
194 gdb_test "ptype F" {type = void \(\*\)\(int\)} "test type of F in k3_m"
196 if $have_older_template_gcc { setup_xfail "*-*-*"
197 } elseif { $using_gcc } { setup_xfail gcc/49546 "*-*-*" }
198 gdb_test "print F" { = \(void \(\*\)\(int\)\) 0x[0-9a-f]+ <S3::m\(int\)>} \
199          "test value of F in k3_m"