[gdb/syscalls] Sync with strace v6.13
[binutils-gdb.git] / gdb / testsuite / gdb.cp / ctti.exp
blob493e56500a78bc5134d905ee419def416e2889b2
1 # Copyright 1998-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/>.
16 # This file is part of the gdb testsuite
17 # file written by Elena Zannoni (ezannoni@cygnus.com)
18 # rewritten by Michael Chastain (mec.gnu@mindspring.com)
20 # source files cttiadd.cc, cttiadd1.cc, cttiadd2.cc, cttiadd3.cc
22 # Call to template instantiations.
24 require allow_cplus_tests
26 standard_testfile cttiadd.cc cttiadd1.cc cttiadd2.cc cttiadd3.cc
28 if {[prepare_for_testing "failed to prepare" $testfile \
29          [list $srcfile $srcfile2 $srcfile3 $srcfile4] {debug c++}]} {
30     return -1
33 if {![runto_main]} {
34     return
37 gdb_breakpoint [gdb_get_line_number "marker add1"]
38 gdb_continue_to_breakpoint "marker add1"
40 gdb_test "print c" "\\$\[0-9\]+ = 194 .*"
41 gdb_test "print f" "\\$\[0-9\]+ = 9"
42 gdb_test "print i" "\\$\[0-9\]+ = 4"
44 gdb_test_multiple "print add<int>(2,2)" "print add<int>(2,2)" {
45     -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
46         pass "print add<int>(2,2)"
47     }
48     -re "No symbol \"add<int>\" in current context.\r\n$gdb_prompt $" {
49         fail "print add<int>(2,2)"
50     }
53 # Note: 2.25 and 4.5 are exactly representable in IEEE-ish formats
54 gdb_test_multiple "print add<float>(2.25,2.25)" "print add<float>(2.25,2.25)" {
55     -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
56         pass "print add<float>(2.25,2.25)"
57     }
58     -re "No symbol \"add<float>\" in current context.\r\n$gdb_prompt $" {
59         fail "print add<float>(2.25,2.25)"
60     }
63 gdb_test_multiple "print add<unsigned char>('A','A')" "print add<unsigned char>('A','A')" {
64     -re "\\$\[0-9\]+ = 130 .*\r\n$gdb_prompt $" {
65         pass "print add<unsigned char>('A','A')"
66     }
67     -re "No symbol \"add<unsigned char>\" in current context.\r\n$gdb_prompt $" {
68         fail "print add<unsigned char>('A','A')"
69     }
72 gdb_test_multiple "print add2<int>(2,2)" "print add2<int>(2,2)" {
73     -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
74         pass "print add2<int>(2,2)"
75     }
76     -re "No symbol \"add2<int>\" in current context.\r\n$gdb_prompt $" {
77         fail "print add2<int>(2,2)"
78     }
81 gdb_test_multiple "print add2<float>(2.25,2.25)" "print add2<float>(2.25,2.25)" {
82     -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
83         pass "print add2<float>(2.25,2.25)"
84     }
85     -re "No symbol \"add2<float>\" in current context.\r\n$gdb_prompt $" {
86         fail "print add2<float>(2.25,2.25)"
87     }
90 gdb_test_multiple "print add2<unsigned char>('A','A')" "print add2<unsigned char>('A','A')" {
91     -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
92         pass "print add2<unsigned char>('A','A')"
93     }
94     -re "No symbol \"add2<unsigned char>\" in current context.\r\n$gdb_prompt $" {
95         fail "print add2<unsigned char>('A','A')"
96     }
99 gdb_test_multiple "print add3<int>(2,2)" "print add3<int>(2,2)" {
100     -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
101         pass "print add3<int>(2,2)"
102     }
103     -re "No symbol \"add3<int>\" in current context.\r\n$gdb_prompt $" {
104         fail "print add3<int>(2,2)"
105     }
108 gdb_test_multiple "print add3<float>(2.25,2.25)" "print add3<float>(2.25,2.25)" {
109     -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
110         pass "print add3<float>(2.25,2.25)"
111     }
112     -re "No symbol \"add3<float>\" in current context.\r\n$gdb_prompt $" {
113         fail "print add3<float>(2.25,2.25)"
114     }
117 gdb_test_multiple "print add3<unsigned char>('A','A')" "print add3<unsigned char>('A','A')" {
118     -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
119         pass "print add3<unsigned char>('A','A')"
120     }
121     -re "No symbol \"add3<unsigned char>\" in current context.\r\n$gdb_prompt $" {
122         fail "print add3<unsigned char>('A','A')"
123     }
126 gdb_test_multiple "print add4<int>(2,2)" "print add4<int>(2,2)" {
127     -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" {
128         pass "print add4<int>(2,2)"
129     }
130     -re "No symbol \"add4<int>\" in current context.\r\n$gdb_prompt $" {
131         fail "print add4<int>(2,2)"
132     }
135 gdb_test_multiple "print add4<float>(2.25,2.25)" "print add4<float>(2.25,2.25)" {
136     -re "\\$\[0-9\]+ = 4\\.5\r\n$gdb_prompt $" {
137         pass "print add4<float>(2.25,2.25)"
138     }
139     -re "No symbol \"add4<float>\" in current context.\r\n$gdb_prompt $" {
140         fail "print add4<float>(2.25,2.25)"
141     }
144 gdb_test_multiple "print add4<unsigned char>('A','A')" "print add4<unsigned char>('A','A')" {
145     -re "\\$\[0-9]+ = 130 .*$gdb_prompt $" {
146         pass "print add4<unsigned char>('A','A')"
147     }
148     -re "No symbol \"add4<unsigned char>\" in current context.\r\n$gdb_prompt $" {
149         fail "print add4<unsigned char>('A','A')"
150     }