PR gold/14309
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / ref-params.exp
CommitLineData
fb933624 1# Tests for reference parameters of types and their subtypes in GDB.
0b302171 2# Copyright 2006-2012 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
23if { [skip_cplus_tests] } { continue }
24
25set testfile "ref-params"
26set srcfile ${testfile}.cc
27set binfile ${objdir}/${subdir}/${testfile}
28
29if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
b60f0898
JB
30 untested ref-params.exp
31 return -1
fb933624
DJ
32}
33
34gdb_exit
35
36proc gdb_start_again { text } {
37 global srcdir
38 global subdir
39 global binfile
40 global srcfile
41
44efa07a 42 gdb_exit
fb933624
DJ
43 gdb_start
44 gdb_reinitialize_dir $srcdir/$subdir
45 gdb_load ${binfile}
46
47 runto ${srcfile}:[gdb_get_line_number $text]
48}
49
50gdb_start_again "marker1 here"
51gdb_test "print Q" ".*id = 42.*" "print value of a Child in main"
52gdb_test "print f1(Q)" ".* = 42.*" "print value of f1 on Child in main"
53gdb_test "print f2(Q)" ".* = 42.*" "print value of f2 on Child in main"
54
55gdb_start_again "marker1 here"
56gdb_test "print f1(QR)" ".* = 42.*" "print value of f1 on (Child&) in main"
57
58gdb_start_again "marker1 here"
59gdb_test "print f2(QR)" ".* = 42.*" "print value of f2 on (Child&) in main"
60
61gdb_start_again "marker2 here"
62gdb_test "print C" ".*id = 42.*" "print value of Child& in f2"
63gdb_test "print f1(C)" ".* = 42.*" "print value of f1 on Child& in f2"
64
65gdb_start_again "marker3 here"
66gdb_test "print R" ".*id = 42.*" "print value of Parent& in f1"
67
68gdb_start_again "breakpoint MQ here"
69gdb_test "print f1(MQ)" ".* = 53"
70gdb_test "print mf1(MQ)" ".* = 106"
71gdb_test "print mf2(MQ)" ".* = 106"
72gdb_test "print f1(MQR)" ".* = 53"
73gdb_test "print mf1(MQR)" ".* = 106"
74gdb_test "print mf2(MQR)" ".* = 106"
This page took 0.614682 seconds and 4 git commands to generate.