OLD | NEW |
1 # Tests for reference parameters of types and their subtypes in GDB. | 1 # Tests for reference parameters of types and their subtypes in GDB. |
2 # Copyright 2006-2012 Free Software Foundation, Inc. | 2 # Copyright 2006-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 Paul N. Hilfinger (Hilfinger@adacore.com) | 17 # written by Paul N. Hilfinger (Hilfinger@adacore.com) |
18 | 18 |
19 if $tracelevel then { | |
20 strace $tracelevel | |
21 } | |
22 | |
23 # | 19 # |
24 # test running programs | 20 # test running programs |
25 # | 21 # |
26 | 22 |
27 if { [skip_cplus_tests] } { continue } | 23 if { [skip_cplus_tests] } { continue } |
28 | 24 |
29 set testfile "ref-params" | 25 standard_testfile .cc |
30 set srcfile ${testfile}.cc | |
31 set binfile ${objdir}/${subdir}/${testfile} | |
32 | 26 |
33 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 27 if {[build_executable $testfile.exp $testfile $srcfile {debug c++}] == 1} { |
34 untested ref-params.exp | 28 return -1 |
35 return -1 | |
36 } | 29 } |
37 | 30 |
38 gdb_exit | 31 gdb_exit |
39 | 32 |
40 proc gdb_start_again { text } { | 33 proc gdb_start_again { text } { |
41 global srcdir | |
42 global subdir | |
43 global binfile | 34 global binfile |
44 global srcfile | 35 global srcfile |
45 | 36 |
46 gdb_exit | 37 clean_restart $binfile |
47 gdb_start | |
48 gdb_reinitialize_dir $srcdir/$subdir | |
49 gdb_load ${binfile} | |
50 | 38 |
51 runto ${srcfile}:[gdb_get_line_number $text] | 39 runto ${srcfile}:[gdb_get_line_number $text] |
52 } | 40 } |
53 | 41 |
54 gdb_start_again "marker1 here" | 42 gdb_start_again "marker1 here" |
55 gdb_test "print Q" ".*id = 42.*" "print value of a Child in main" | 43 gdb_test "print Q" ".*id = 42.*" "print value of a Child in main" |
56 gdb_test "print f1(Q)" ".* = 42.*" "print value of f1 on Child in main" | 44 gdb_test "print f1(Q)" ".* = 42.*" "print value of f1 on Child in main" |
57 gdb_test "print f2(Q)" ".* = 42.*" "print value of f2 on Child in main" | 45 gdb_test "print f2(Q)" ".* = 42.*" "print value of f2 on Child in main" |
58 | 46 |
59 gdb_start_again "marker1 here" | 47 gdb_start_again "marker1 here" |
60 gdb_test "print f1(QR)" ".* = 42.*" "print value of f1 on (Child&) in main" | 48 gdb_test "print f1(QR)" ".* = 42.*" "print value of f1 on (Child&) in main" |
61 | 49 |
62 gdb_start_again "marker1 here" | 50 gdb_start_again "marker1 here" |
63 gdb_test "print f2(QR)" ".* = 42.*" "print value of f2 on (Child&) in main" | 51 gdb_test "print f2(QR)" ".* = 42.*" "print value of f2 on (Child&) in main" |
64 | 52 |
65 gdb_start_again "marker2 here" | 53 gdb_start_again "marker2 here" |
66 gdb_test "print C" ".*id = 42.*" "print value of Child& in f2" | 54 gdb_test "print C" ".*id = 42.*" "print value of Child& in f2" |
67 gdb_test "print f1(C)" ".* = 42.*" "print value of f1 on Child& in f2" | 55 gdb_test "print f1(C)" ".* = 42.*" "print value of f1 on Child& in f2" |
68 | 56 |
69 gdb_start_again "marker3 here" | 57 gdb_start_again "marker3 here" |
70 gdb_test "print R" ".*id = 42.*" "print value of Parent& in f1" | 58 gdb_test "print R" ".*id = 42.*" "print value of Parent& in f1" |
71 | 59 |
72 gdb_start_again "breakpoint MQ here" | 60 gdb_start_again "breakpoint MQ here" |
73 gdb_test "print f1(MQ)" ".* = 53" | 61 gdb_test "print f1(MQ)" ".* = 53" |
74 gdb_test "print mf1(MQ)" ".* = 106" | 62 gdb_test "print mf1(MQ)" ".* = 106" |
75 gdb_test "print mf2(MQ)" ".* = 106" | 63 gdb_test "print mf2(MQ)" ".* = 106" |
76 gdb_test "print f1(MQR)" ".* = 53" | 64 gdb_test "print f1(MQR)" ".* = 53" |
77 gdb_test "print mf1(MQR)" ".* = 106" | 65 gdb_test "print mf1(MQR)" ".* = 106" |
78 gdb_test "print mf2(MQR)" ".* = 106" | 66 gdb_test "print mf2(MQR)" ".* = 106" |
OLD | NEW |