OLD | NEW |
1 # Tests of overloaded operators resolution. | 1 # Tests of overloaded operators resolution. |
2 # Copyright 1998-1999, 2002, 2004-2012 Free Software Foundation, Inc. | 2 # Copyright 1998-1999, 2002, 2004-2012 Free Software Foundation, Inc. |
3 | 3 |
4 # This program is free software; you can redistribute it and/or modify | 4 # This program is free software; you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License as published by | 5 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation; either version 3 of the License, or | 6 # the Free Software Foundation; either version 3 of the License, or |
7 # (at your option) any later version. | 7 # (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
17 # written by Elena Zannoni (ezannoni@cygnus.com) | 17 # written by Elena Zannoni (ezannoni@cygnus.com) |
18 # | 18 # |
19 # source file "userdef.cc" | 19 # source file "userdef.cc" |
20 # | 20 # |
21 | 21 |
22 if $tracelevel then { | |
23 strace $tracelevel | |
24 } | |
25 | |
26 if { [skip_stl_tests] } { continue } | 22 if { [skip_stl_tests] } { continue } |
27 | 23 |
28 # On SPU this test fails because the executable exceeds local storage size. | 24 # On SPU this test fails because the executable exceeds local storage size. |
29 if { [istarget "spu*-*-*"] } { | 25 if { [istarget "spu*-*-*"] } { |
30 return 0 | 26 return 0 |
31 } | 27 } |
32 | 28 |
33 set testfile "userdef" | 29 standard_testfile .cc |
34 set srcfile ${testfile}.cc | |
35 set binfile ${objdir}/${subdir}/${testfile} | |
36 | 30 |
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 31 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
38 untested userdef.exp | 32 return -1 |
39 return -1 | |
40 } | 33 } |
41 | 34 |
42 | |
43 gdb_exit | |
44 gdb_start | |
45 gdb_reinitialize_dir $srcdir/$subdir | |
46 gdb_load ${binfile} | |
47 | |
48 | |
49 if ![runto_main] then { | 35 if ![runto_main] then { |
50 perror "couldn't run to breakpoint" | 36 perror "couldn't run to breakpoint" |
51 continue | 37 continue |
52 } | 38 } |
53 | 39 |
54 gdb_test "break marker1" \ | 40 gdb_test "break marker1" \ |
55 "Breakpoint .*${srcfile}.*" | 41 "Breakpoint .*${srcfile}.*" |
56 | 42 |
57 gdb_test "cont" \ | 43 gdb_test "cont" \ |
58 "Break.* marker1(\\(\\)|) \\(\\) at .*:$decimal.*" \ | 44 "Break.* marker1(\\(\\)|) \\(\\) at .*:$decimal.*" \ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 119 |
134 gdb_test "print one--" "\\\$\[0-9\]* = {x = 3, y = 3}" | 120 gdb_test "print one--" "\\\$\[0-9\]* = {x = 3, y = 3}" |
135 | 121 |
136 gdb_test "print --one" "\\\$\[0-9\]* = {x = 2, y = 3}" | 122 gdb_test "print --one" "\\\$\[0-9\]* = {x = 2, y = 3}" |
137 | 123 |
138 gdb_test "print one += 7" "\\\$\[0-9\]* = {x = 9, y = 10}" | 124 gdb_test "print one += 7" "\\\$\[0-9\]* = {x = 9, y = 10}" |
139 | 125 |
140 gdb_test "print two = one" "\\\$\[0-9\]* = {x = 9, y = 10}" | 126 gdb_test "print two = one" "\\\$\[0-9\]* = {x = 9, y = 10}" |
141 | 127 |
142 # Check that GDB tolerates whitespace in operator names. | 128 # Check that GDB tolerates whitespace in operator names. |
143 gdb_test "break A2::'operator+'" ".*Breakpoint $decimal at.*" | 129 gdb_test "break A2::operator+" ".*Breakpoint $decimal at.*" |
144 gdb_test "break A2::'operator +'" ".*Breakpoint $decimal at.*" | 130 gdb_test "break A2::operator +" ".*Breakpoint $decimal at.*" |
145 | 131 |
146 # Check that GDB handles operator* correctly. | 132 # Check that GDB handles operator* correctly. |
147 gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}" | 133 gdb_test "print c" "\\\$\[0-9\]* = {m = {z = .*}}" |
148 gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}" | 134 gdb_test "print *c" "\\\$\[0-9\]* = \\(Member &\\) @$hex: {z = .*}" |
149 gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex" | 135 gdb_test "print &*c" "\\\$\[0-9\]* = \\(Member \\*\\) $hex" |
150 gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \
]+int z;\[\r\n\].*} &\\*" | 136 gdb_test "ptype &*c" "type = (struct|class) Member {(\[\r\n \]+public:)?\[\r\n \
]+int z;\[\r\n\].*} &\\*" |
151 | 137 |
152 gdb_test "print operator== (mem1, mem2)" " = false" | 138 gdb_test "print operator== (mem1, mem2)" " = false" |
153 gdb_test "print operator== (mem1, mem1)" " = true" | 139 gdb_test "print operator== (mem1, mem1)" " = true" |
154 | 140 |
155 gdb_exit | 141 gdb_exit |
156 return 0 | 142 return 0 |
OLD | NEW |