Commit | Line | Data |
---|---|---|
fb933624 | 1 | # Tests for reference parameters of types and their subtypes in GDB. |
e2882c85 | 2 | # Copyright 2006-2018 Free Software Foundation, Inc. |
fb933624 DJ |
3 | |
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 | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
fb933624 | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
fb933624 DJ |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
fb933624 | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
fb933624 DJ |
16 | |
17 | # written by Paul N. Hilfinger (Hilfinger@adacore.com) | |
18 | ||
fb933624 DJ |
19 | # |
20 | # test running programs | |
21 | # | |
fb933624 DJ |
22 | |
23 | if { [skip_cplus_tests] } { continue } | |
24 | ||
f5f3a911 | 25 | standard_testfile .cc |
fb933624 | 26 | |
f5f3a911 TT |
27 | if {[build_executable $testfile.exp $testfile $srcfile {debug c++}] == 1} { |
28 | return -1 | |
fb933624 DJ |
29 | } |
30 | ||
31 | gdb_exit | |
32 | ||
33 | proc gdb_start_again { text } { | |
fb933624 DJ |
34 | global binfile |
35 | global srcfile | |
36 | ||
f5f3a911 | 37 | clean_restart $binfile |
fb933624 DJ |
38 | |
39 | runto ${srcfile}:[gdb_get_line_number $text] | |
40 | } | |
41 | ||
42 | gdb_start_again "marker1 here" | |
43 | gdb_test "print Q" ".*id = 42.*" "print value of a Child in main" | |
44 | gdb_test "print f1(Q)" ".* = 42.*" "print value of f1 on Child in main" | |
45 | gdb_test "print f2(Q)" ".* = 42.*" "print value of f2 on Child in main" | |
46 | ||
47 | gdb_start_again "marker1 here" | |
48 | gdb_test "print f1(QR)" ".* = 42.*" "print value of f1 on (Child&) in main" | |
49 | ||
50 | gdb_start_again "marker1 here" | |
51 | gdb_test "print f2(QR)" ".* = 42.*" "print value of f2 on (Child&) in main" | |
52 | ||
53 | gdb_start_again "marker2 here" | |
54 | gdb_test "print C" ".*id = 42.*" "print value of Child& in f2" | |
55 | gdb_test "print f1(C)" ".* = 42.*" "print value of f1 on Child& in f2" | |
56 | ||
57 | gdb_start_again "marker3 here" | |
58 | gdb_test "print R" ".*id = 42.*" "print value of Parent& in f1" | |
59 | ||
60 | gdb_start_again "breakpoint MQ here" | |
61 | gdb_test "print f1(MQ)" ".* = 53" | |
62 | gdb_test "print mf1(MQ)" ".* = 106" | |
63 | gdb_test "print mf2(MQ)" ".* = 106" | |
64 | gdb_test "print f1(MQR)" ".* = 53" | |
65 | gdb_test "print mf1(MQR)" ".* = 106" | |
66 | gdb_test "print mf2(MQR)" ".* = 106" |