OLD | NEW |
1 # Copyright 1992, 1994-1997, 1999, 2002, 2007-2012 Free Software | 1 # Copyright 1992, 1994-1997, 1999, 2002, 2007-2012 Free Software |
2 # Foundation, Inc. | 2 # 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 # This file was written by Fred Fish. (fnf@cygnus.com) | 17 # This file was written by Fred Fish. (fnf@cygnus.com) |
18 | 18 |
19 if $tracelevel then { | |
20 strace $tracelevel | |
21 } | |
22 | |
23 if { [skip_cplus_tests] } { continue } | 19 if { [skip_cplus_tests] } { continue } |
24 | 20 |
25 set testfile "misc" | 21 standard_testfile .cc |
26 set srcfile ${testfile}.cc | 22 |
27 set binfile ${objdir}/${subdir}/${testfile} | 23 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
28 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 24 return -1 |
29 untested misc.exp | |
30 return -1 | |
31 } | 25 } |
32 | 26 |
33 # | 27 # |
34 # Deduce language of main() | 28 # Deduce language of main() |
35 # | 29 # |
36 | 30 |
37 proc deduce_language_of_main {} { | 31 proc deduce_language_of_main {} { |
38 global gdb_prompt | 32 global gdb_prompt |
39 | 33 |
40 # See what language gdb thinks main() is, prior to reading full symbols. | 34 # See what language gdb thinks main() is, prior to reading full symbols. |
(...skipping 22 matching lines...) Expand all Loading... |
63 } | 57 } |
64 for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} { | 58 for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} { |
65 if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname (
[lindex $args $x])"] { | 59 if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname (
[lindex $args $x])"] { |
66 gdb_suppress_tests; | 60 gdb_suppress_tests; |
67 } | 61 } |
68 } | 62 } |
69 gdb_stop_suppressing_tests; | 63 gdb_stop_suppressing_tests; |
70 } | 64 } |
71 | 65 |
72 proc do_tests {} { | 66 proc do_tests {} { |
73 global subdir | |
74 global objdir | |
75 global srcdir | |
76 global binfile | |
77 global gdb_prompt | |
78 | |
79 | |
80 # Start with a fresh gdb. | |
81 | |
82 gdb_exit | |
83 gdb_start | |
84 gdb_reinitialize_dir $srcdir/$subdir | |
85 gdb_load $binfile | |
86 | |
87 deduce_language_of_main | 67 deduce_language_of_main |
88 # Check for fixes for PRs 8916 and 8630 | 68 # Check for fixes for PRs 8916 and 8630 |
89 gdb_test "print s.a" ".* = 0" "print s.a for foo struct (known gcc 2.7.2 and
earlier bug)" | 69 gdb_test "print s.a" ".* = 0" "print s.a for foo struct (known gcc 2.7.2 and
earlier bug)" |
90 } | 70 } |
91 | 71 |
92 do_tests | 72 do_tests |
93 | 73 |
94 test_expr "set language c++" \ | 74 test_expr "set language c++" \ |
95 "print 1 == 1" "print.*\\$\[0-9\]* = true" \ | 75 "print 1 == 1" "print.*\\$\[0-9\]* = true" \ |
96 "print 1 == 2" "print.*\\$\[0-9\]* = false" \ | 76 "print 1 == 2" "print.*\\$\[0-9\]* = false" \ |
(...skipping 24 matching lines...) Expand all Loading... |
121 gdb_test "print 1 + true" "\\$\[0-9\]* = 2" "1 + true" | 101 gdb_test "print 1 + true" "\\$\[0-9\]* = 2" "1 + true" |
122 gdb_test "print 3 + false" "\\$\[0-9\]* = 3" "3 + false" | 102 gdb_test "print 3 + false" "\\$\[0-9\]* = 3" "3 + false" |
123 gdb_test "print 1 < 2 < 3" "\\$\[0-9\]* = true" "1 < 2 < 3" | 103 gdb_test "print 1 < 2 < 3" "\\$\[0-9\]* = true" "1 < 2 < 3" |
124 gdb_test "print 2 < 1 > 4" "\\$\[0-9\]* = false" "2 < 1 > 4" | 104 gdb_test "print 2 < 1 > 4" "\\$\[0-9\]* = false" "2 < 1 > 4" |
125 gdb_test "print (bool)43" "\\$\[0-9\]* = true" "(bool)43" | 105 gdb_test "print (bool)43" "\\$\[0-9\]* = true" "(bool)43" |
126 gdb_test "print (bool)0" "\\$\[0-9\]* = false" "(bool)0" | 106 gdb_test "print (bool)0" "\\$\[0-9\]* = false" "(bool)0" |
127 gdb_test "print (bool)17.93" "\\$\[0-9\]* = true" "(bool)17.93" | 107 gdb_test "print (bool)17.93" "\\$\[0-9\]* = true" "(bool)17.93" |
128 gdb_test "print (bool)0.0" "\\$\[0-9\]* = false" "(bool)0.0" | 108 gdb_test "print (bool)0.0" "\\$\[0-9\]* = false" "(bool)0.0" |
129 gdb_test "print (int)true" "\\$\[0-9\]* = 1" "(int)true" | 109 gdb_test "print (int)true" "\\$\[0-9\]* = 1" "(int)true" |
130 gdb_test "print (int)false" "\\$\[0-9\]* = 0" "(int)false" | 110 gdb_test "print (int)false" "\\$\[0-9\]* = 0" "(int)false" |
OLD | NEW |