Commit | Line | Data |
---|---|---|
34eaf542 TT |
1 | # temargs.exp - Template argument tests |
2 | # | |
3 | # Copyright 2010 Free Software Foundation, Inc. | |
4 | # | |
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. | |
9 | # | |
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. | |
14 | # | |
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/>. | |
17 | ||
18 | # This file is part of the gdb testsuite. | |
19 | ||
20 | if {$tracelevel} { | |
21 | strace $tracelevel | |
22 | } | |
23 | ||
24 | if {[skip_cplus_tests]} { | |
25 | continue | |
26 | } | |
27 | ||
28 | set testfile "temargs" | |
29 | set srcfile "${testfile}.cc" | |
30 | ||
31 | if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { | |
32 | return -1 | |
33 | } | |
34 | ||
35 | if {![runto_main]} { | |
36 | return -1 | |
37 | } | |
38 | ||
39 | set line [gdb_get_line_number "Breakpoint 1" $srcfile] | |
40 | gdb_test "break $srcfile:$line" "Breakpoint 2.*" \ | |
41 | "set first breakpoint for temargs" | |
42 | set line [gdb_get_line_number "Breakpoint 2" $srcfile] | |
43 | gdb_test "break $srcfile:$line" "Breakpoint 3.*" \ | |
44 | "set second breakpoint for temargs" | |
45 | set line [gdb_get_line_number "Breakpoint 3" $srcfile] | |
46 | gdb_test "break $srcfile:$line" "Breakpoint 4.*" \ | |
47 | "set third breakpoint for temargs" | |
48 | set line [gdb_get_line_number "Breakpoint 4" $srcfile] | |
49 | gdb_test "break $srcfile:$line" "Breakpoint 5.*" \ | |
50 | "set fourth breakpoint for temargs" | |
51 | ||
52 | # | |
53 | # Tests in Base::base_m. | |
54 | # | |
55 | ||
56 | gdb_continue_to_breakpoint "continue to first breakpoint for temargs" | |
57 | ||
58 | gdb_test "ptype T" "double" "test type of T in base_m" | |
59 | gdb_test "print I" " = 23" "test value of I in base_m" | |
60 | gdb_test "print P == &a_global" " = true" "test value of P in base_m" | |
61 | setup_kfail "gcc/41736" *-*-* | |
62 | gdb_test "print MP" "&S::f" "test value of MP in base_m" | |
63 | ||
64 | # | |
65 | # Tests in Inner::inner_m. | |
66 | # | |
67 | ||
68 | gdb_continue_to_breakpoint "continue to second breakpoint for temargs" | |
69 | ||
70 | setup_kfail "gcc/45024" *-*-* | |
71 | gdb_test "ptype T" "long" "test type of T in inner_m" | |
72 | setup_kfail "gcc/45024" *-*-* | |
73 | gdb_test "print I" " = 47" "test value of I in inner_m" | |
74 | gdb_test "print P == &a_global" " = true" "test value of P in inner_m" | |
75 | setup_kfail "gcc/41736" *-*-* | |
76 | gdb_test "print MP" "&S::f" "test value of MP in inner_m" | |
77 | gdb_test "whatis Z" "float" "test type of Z in inner_m" | |
78 | ||
79 | # | |
80 | # Tests in func. | |
81 | # | |
82 | ||
83 | gdb_continue_to_breakpoint "continue to third breakpoint for temargs" | |
84 | ||
85 | gdb_test "ptype T" "unsigned char" "test type of T in func" | |
86 | gdb_test "print I" " = 91" "test value of I in func" | |
87 | gdb_test "print P == &a_global" " = true" "test value of P in func" | |
88 | setup_kfail "gcc/41736" *-*-* | |
89 | gdb_test "print MP" "&S::f" "test value of MP in func" | |
90 | ||
91 | # | |
92 | # Tests in Base::templ_m. | |
93 | # | |
94 | ||
95 | gdb_continue_to_breakpoint "continue to fourth breakpoint for temargs" | |
96 | ||
97 | gdb_test "ptype T" "double" "test type of T in templ_m" | |
98 | gdb_test "print I" " = 23" "test value of I in templ_m" | |
99 | gdb_test "print P == &a_global" " = true" "test value of P in templ_m" | |
100 | setup_kfail "gcc/41736" *-*-* | |
101 | gdb_test "print MP" "&S::f" "test value of MP in templ_m" | |
102 | gdb_test "whatis Q" "short" "test type of Q in templ_m" |