summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.c++/m-static.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.c++/m-static.exp')
-rw-r--r--gdb/testsuite/gdb.c++/m-static.exp30
1 files changed, 23 insertions, 7 deletions
diff --git a/gdb/testsuite/gdb.c++/m-static.exp b/gdb/testsuite/gdb.c++/m-static.exp
index c05983b6538..d291135fb06 100644
--- a/gdb/testsuite/gdb.c++/m-static.exp
+++ b/gdb/testsuite/gdb.c++/m-static.exp
@@ -16,6 +16,7 @@
# Tests for member static data
# 2002-05-13 Benjamin Kosnik <bkoz@redhat.com>
+# 2002-08-22 David Carlton <carlton@math.stanford.edu>
# This file is part of the gdb testsuite
@@ -33,9 +34,10 @@ set bug_id 0
set testfile "m-static"
set srcfile ${testfile}.cc
+set srcfile1 ${testfile}1.cc
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1}" "${binfile}" executable {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
@@ -54,9 +56,13 @@ if ![runto_main] then {
continue
}
+# First, run to after we've constructed all the objects:
+
+gdb_breakpoint [gdb_get_line_number "constructs-done"]
+gdb_continue_to_breakpoint "end of constructors"
+
+
# One.
-gdb_test "break 68" "Breakpoint \[0-9\]*.*line 68\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:68\r\n.*" "continue to 68"
# simple object, static const bool
gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool"
@@ -71,8 +77,6 @@ gdb_test "print test1.key2" "\\$\[0-9\]* = 77" "simple object, static long"
gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum"
# Two.
-gdb_test "break 69" "Breakpoint \[0-9\]*.*line 69\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:69\r\n.*" "continue to 69"
# derived template object, base static const bool
gdb_test "print test2.test" "\\$\[0-9\]* = true" "derived template object, base static const bool"
@@ -90,8 +94,6 @@ gdb_test "print test2.value" "\\$\[0-9\].* = oriental" "derived template object,
gdb_test "print test2.value_derived" "\\$\[0-9\].* = etruscan" "derived template object, static enum"
# Three.
-gdb_test "break 71" "Breakpoint \[0-9\]*.*line 71\\."
-gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*m-static\\.cc:71\r\n.*" "continue to 71"
# template object, static derived template data member's base static const bool
gdb_test "print test3.data.test" "\\$\[0-9\].* = true" "template object, static const bool"
@@ -108,5 +110,19 @@ gdb_test "print test3.data.value" "\\$\[0-9\].* = oriental" "template object, st
# template object, static derived template data member's static enum
gdb_test "print test3.data.value_derived" "\\$\[0-9\].* = etruscan" "template object, static derived enum"
+# 2002-08-16
+# Four.
+
+# static const int initialized in another file.
+gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere"
+
+# static const int that nobody initializes. From PR gdb/635.
+gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere"
+
+# Perhaps at some point test4 should also include a test for a static
+# const int that was initialized in the header file. But I'm not sure
+# that GDB's current behavior in such situations is either consistent
+# across platforms or optimal, so I'm not including one now.
+
gdb_exit
return 0