OLD | NEW |
1 # Tests for anonymous union support. | 1 # Tests for anonymous union support. |
2 # Copyright 1998-1999, 2003-2004, 2007-2012 Free Software Foundation, | 2 # Copyright 1998-1999, 2003-2004, 2007-2012 Free Software Foundation, |
3 # Inc. | 3 # Inc. |
4 | 4 |
5 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 7 # the Free Software Foundation; either version 3 of the License, or |
8 # (at your option) any later version. | 8 # (at your option) any later version. |
9 # | 9 # |
10 # This program is distributed in the hope that it will be useful, | 10 # This program is distributed in the hope that it will be useful, |
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 # GNU General Public License for more details. | 13 # GNU General Public License for more details. |
14 # | 14 # |
15 # You should have received a copy of the GNU General Public License | 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/>. | 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 |
18 # Written by Satish Pai <pai@apollo.hp.com> 1997-08-19 | 18 # Written by Satish Pai <pai@apollo.hp.com> 1997-08-19 |
19 | 19 |
20 # This file is part of the gdb testsuite | 20 # This file is part of the gdb testsuite |
21 | 21 |
22 if $tracelevel then { | |
23 strace $tracelevel | |
24 } | |
25 | |
26 # | 22 # |
27 # test running programs | 23 # test running programs |
28 # | 24 # |
29 | 25 |
30 | 26 |
31 if { [skip_cplus_tests] } { continue } | 27 if { [skip_cplus_tests] } { continue } |
32 | 28 |
33 set testfile "anon-union" | 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 perror "Testcase compile failed" 0 | 32 return -1 |
39 continue | |
40 } | 33 } |
41 | 34 |
42 # Start with a fresh gdb | |
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_no_output "set width 0" | 40 gdb_test_no_output "set width 0" |
55 | 41 |
56 #send_gdb "ptype foo\n" | 42 #send_gdb "ptype foo\n" |
57 #gdb_expect { | 43 #gdb_expect { |
58 # -re "\r\n$gdb_prompt $" { | 44 # -re "\r\n$gdb_prompt $" { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 gdb_test "print z" "\\$\[0-9\]* = 45" "print z 2" | 153 gdb_test "print z" "\\$\[0-9\]* = 45" "print z 2" |
168 | 154 |
169 # Set the anon union member | 155 # Set the anon union member |
170 gdb_test_no_output "set var z = 27" "set var z" | 156 gdb_test_no_output "set var z = 27" "set var z" |
171 | 157 |
172 # See if the change in value is noticed | 158 # See if the change in value is noticed |
173 gdb_test "print w" "\\$\[0-9\]* = 27" "print w 3" | 159 gdb_test "print w" "\\$\[0-9\]* = 27" "print w 3" |
174 | 160 |
175 # See if z shows the same value | 161 # See if z shows the same value |
176 gdb_test "print z" "\\$\[0-9\]* = 27" "print z 3" | 162 gdb_test "print z" "\\$\[0-9\]* = 27" "print z 3" |
OLD | NEW |