]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.cp/m-static.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / m-static.exp
CommitLineData
6aba47ca 1# Copyright 2002, 2004, 2007 Free Software Foundation, Inc.
258093ca
MC
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17# Tests for member static data
18# 2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
e70d6e3f 19# 2002-08-22 David Carlton <carlton@math.stanford.edu>
258093ca
MC
20
21# This file is part of the gdb testsuite
22
23if $tracelevel then {
24 strace $tracelevel
25 }
26
27if { [skip_cplus_tests] } { continue }
28
29#
30# test running programs
31#
32set prms_id 0
33set bug_id 0
34
35set testfile "m-static"
dd8c8ee7
MC
36set srcfile "${testfile}.cc"
37set srcfile1 "${testfile}1.cc"
38set objfile "${testfile}.o"
39set objfile1 "${testfile}1.o"
f8d4bac4 40set binfile "${objdir}/${subdir}/${testfile}"
258093ca 41
dd8c8ee7 42if { [gdb_compile "$srcdir/$subdir/$srcfile" "$objdir/$subdir/$objfile" object {debug c++}] != "" } {
b60f0898
JB
43 untested m-static.exp
44 return -1
258093ca
MC
45}
46
dd8c8ee7 47if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
b60f0898
JB
48 untested m-static.exp
49 return -1
f8d4bac4
MC
50}
51
dd8c8ee7 52if { [gdb_compile "$objdir/$subdir/$objfile $objdir/$subdir/$objfile1" "${binfile}" executable {debug c++}] != "" } {
b60f0898
JB
53 untested m-static.exp
54 return -1
258093ca
MC
55}
56
57gdb_exit
58gdb_start
59gdb_reinitialize_dir $srcdir/$subdir
60gdb_load ${binfile}
61
62
63if ![runto_main] then {
64 perror "couldn't run to breakpoint"
65 continue
66}
67
e70d6e3f
DC
68# First, run to after we've constructed all the objects:
69
70gdb_breakpoint [gdb_get_line_number "constructs-done"]
71gdb_continue_to_breakpoint "end of constructors"
72
73
258093ca 74# One.
258093ca
MC
75
76# simple object, static const bool
77gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool"
78
79# simple object, static const int
80gdb_test "print test1.key1" "\\$\[0-9\]* = 5" "simple object, static const int"
81
82# simple object, static long
83gdb_test "print test1.key2" "\\$\[0-9\]* = 77" "simple object, static long"
84
85# simple object, static enum
86gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum"
87
88# Two.
258093ca
MC
89
90# derived template object, base static const bool
91gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool"
92
93# derived template object, base static const int
94gdb_test "print test2.key1" "\\$\[0-9\]* = 5" "derived template object, base static const int"
95
96# derived template object, base static long
97gdb_test "print test2.key2" "\\$\[0-9\]* = 77" "derived template object, base static long"
98
99# derived template object, base static enum
100gdb_test "print test2.value" "\\$\[0-9\].* = oriental" "derived template object, base static enum"
101
102# derived template object, static enum
103gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum"
104
105# Three.
258093ca
MC
106
107# template object, static derived template data member's base static const bool
108gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool"
109
110# template object, static derived template data member's base static const int
111gdb_test "print test3.data.key1" "\\$\[0-9\].* = 5" "template object, static const int"
112
113# template object, static derived template data member's base static long
114gdb_test "print test3.data.key2" "\\$\[0-9\].* = 77" "template object, static long"
115
116# template object, static derived template data member's base static enum
117gdb_test "print test3.data.value" "\\$\[0-9\].* = oriental" "template object, static enum"
118
119# template object, static derived template data member's static enum
120gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum"
121
e70d6e3f
DC
122# 2002-08-16
123# Four.
124
125# static const int initialized in another file.
126gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere"
127
128# static const int that nobody initializes. From PR gdb/635.
129gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere"
130
131# Perhaps at some point test4 should also include a test for a static
132# const int that was initialized in the header file. But I'm not sure
133# that GDB's current behavior in such situations is either consistent
134# across platforms or optimal, so I'm not including one now.
135
258093ca
MC
136gdb_exit
137return 0