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