Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.cp / m-static.exp
blob7963a101686599087735e437072437537dcb18db
1 # Copyright 2002, 2004 Free Software Foundation, Inc.
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.
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.
17 # Tests for member static data
18 # 2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
19 # 2002-08-22 David Carlton <carlton@math.stanford.edu>
21 # This file is part of the gdb testsuite
23 if $tracelevel then {
24 strace $tracelevel
27 if { [skip_cplus_tests] } { continue }
30 # test running programs
32 set prms_id 0
33 set bug_id 0
35 set testfile "m-static"
36 set srcfile "${testfile}.cc"
37 set srcfile1 "${testfile}1.cc"
38 set objfile "${testfile}.o"
39 set objfile1 "${testfile}1.o"
40 set binfile "${objdir}/${subdir}/${testfile}"
42 if { [gdb_compile "$srcdir/$subdir/$srcfile" "$objdir/$subdir/$objfile" object {debug c++}] != "" } {
43 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
46 if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
47 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
50 if { [gdb_compile "$objdir/$subdir/$objfile $objdir/$subdir/$objfile1" "${binfile}" executable {debug c++}] != "" } {
51 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
54 gdb_exit
55 gdb_start
56 gdb_reinitialize_dir $srcdir/$subdir
57 gdb_load ${binfile}
60 if ![runto_main] then {
61 perror "couldn't run to breakpoint"
62 continue
65 # First, run to after we've constructed all the objects:
67 gdb_breakpoint [gdb_get_line_number "constructs-done"]
68 gdb_continue_to_breakpoint "end of constructors"
71 # One.
73 # simple object, static const bool
74 gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool"
76 # simple object, static const int
77 gdb_test "print test1.key1" "\\$\[0-9\]* = 5" "simple object, static const int"
79 # simple object, static long
80 gdb_test "print test1.key2" "\\$\[0-9\]* = 77" "simple object, static long"
82 # simple object, static enum
83 gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum"
85 # Two.
87 # derived template object, base static const bool
88 gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool"
90 # derived template object, base static const int
91 gdb_test "print test2.key1" "\\$\[0-9\]* = 5" "derived template object, base static const int"
93 # derived template object, base static long
94 gdb_test "print test2.key2" "\\$\[0-9\]* = 77" "derived template object, base static long"
96 # derived template object, base static enum
97 gdb_test "print test2.value" "\\$\[0-9\].* = oriental" "derived template object, base static enum"
99 # derived template object, static enum
100 gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum"
102 # Three.
104 # template object, static derived template data member's base static const bool
105 gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool"
107 # template object, static derived template data member's base static const int
108 gdb_test "print test3.data.key1" "\\$\[0-9\].* = 5" "template object, static const int"
110 # template object, static derived template data member's base static long
111 gdb_test "print test3.data.key2" "\\$\[0-9\].* = 77" "template object, static long"
113 # template object, static derived template data member's base static enum
114 gdb_test "print test3.data.value" "\\$\[0-9\].* = oriental" "template object, static enum"
116 # template object, static derived template data member's static enum
117 gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum"
119 # 2002-08-16
120 # Four.
122 # static const int initialized in another file.
123 gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere"
125 # static const int that nobody initializes. From PR gdb/635.
126 gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere"
128 # Perhaps at some point test4 should also include a test for a static
129 # const int that was initialized in the header file. But I'm not sure
130 # that GDB's current behavior in such situations is either consistent
131 # across platforms or optimal, so I'm not including one now.
133 gdb_exit
134 return 0