]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.cp/ref-params.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / ref-params.exp
CommitLineData
fb933624 1# Tests for reference parameters of types and their subtypes in GDB.
6aba47ca 2# Copyright 2006, 2007 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
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
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.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18# written by Paul N. Hilfinger (Hilfinger@adacore.com)
19
20if $tracelevel then {
21 strace $tracelevel
22 }
23
24#
25# test running programs
26#
27set prms_id 0
28set bug_id 0
29
30if { [skip_cplus_tests] } { continue }
31
32set testfile "ref-params"
33set srcfile ${testfile}.cc
34set binfile ${objdir}/${subdir}/${testfile}
35
36if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
b60f0898
JB
37 untested ref-params.exp
38 return -1
fb933624
DJ
39}
40
41gdb_exit
42
43proc gdb_start_again { text } {
44 global srcdir
45 global subdir
46 global binfile
47 global srcfile
48
49 gdb_start
50 gdb_reinitialize_dir $srcdir/$subdir
51 gdb_load ${binfile}
52
53 runto ${srcfile}:[gdb_get_line_number $text]
54}
55
56gdb_start_again "marker1 here"
57gdb_test "print Q" ".*id = 42.*" "print value of a Child in main"
58gdb_test "print f1(Q)" ".* = 42.*" "print value of f1 on Child in main"
59gdb_test "print f2(Q)" ".* = 42.*" "print value of f2 on Child in main"
60
61gdb_start_again "marker1 here"
62gdb_test "print f1(QR)" ".* = 42.*" "print value of f1 on (Child&) in main"
63
64gdb_start_again "marker1 here"
65gdb_test "print f2(QR)" ".* = 42.*" "print value of f2 on (Child&) in main"
66
67gdb_start_again "marker2 here"
68gdb_test "print C" ".*id = 42.*" "print value of Child& in f2"
69gdb_test "print f1(C)" ".* = 42.*" "print value of f1 on Child& in f2"
70
71gdb_start_again "marker3 here"
72gdb_test "print R" ".*id = 42.*" "print value of Parent& in f1"
73
74gdb_start_again "breakpoint MQ here"
75gdb_test "print f1(MQ)" ".* = 53"
76gdb_test "print mf1(MQ)" ".* = 106"
77gdb_test "print mf2(MQ)" ".* = 106"
78gdb_test "print f1(MQR)" ".* = 53"
79gdb_test "print mf1(MQR)" ".* = 106"
80gdb_test "print mf2(MQR)" ".* = 106"