aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/namespace.exp
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-09-25 16:39:39 +0000
committerDavid Carlton <carlton@bactrian.org>2003-09-25 16:39:39 +0000
commit79c2c32df4d14566f2d11310fddd4e4ca9ab6542 (patch)
treea5e0893e16910a2814ae39a59ab3293a7d86ecbb /gdb/testsuite/gdb.cp/namespace.exp
parent594e6d67cd35735bd5eb9eca720560a8336eac37 (diff)
downloadgdb-79c2c32df4d14566f2d11310fddd4e4ca9ab6542.zip
gdb-79c2c32df4d14566f2d11310fddd4e4ca9ab6542.tar.gz
gdb-79c2c32df4d14566f2d11310fddd4e4ca9ab6542.tar.bz2
2003-09-25 David Carlton <carlton@kealia.com>
* c-exp.y: Include cp-support.h. Add qualified_type. (yylex): Delete nested type hack; add comments. * cp-namespace.c (cp_lookup_nested_type): New function. * cp-support.h: Declare cp_lookup_nested_type. * eval.c (evaluate_subexp_standard): Call value_aggregate_elt instead of value_struct_elt_for_reference. * valops.c: Include cp-support.h. (value_aggregate_elt): New function. (value_namespace_elt): Ditto. (value_struct_elt_for_reference): Make static. * value.h: Delete declaration of value_struct_elt_for_reference; add declaration for value_aggregate_elt. * Makefile.in (c-exp.tab.o): Depend on $(cp_support_h). (valops.o): Ditto. 2003-09-25 David Carlton <carlton@kealia.com> * gdb.cp/namespace.exp: Tweak comments. Add non-quoted versions of some print tests, where appropriate. Add tests for C::D::cd, E::ce, F::cXfX, G::XgX. * gdb.cp/namespace.cc: Add XgX, cXfX, ce.
Diffstat (limited to 'gdb/testsuite/gdb.cp/namespace.exp')
-rw-r--r--gdb/testsuite/gdb.cp/namespace.exp42
1 files changed, 40 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index 6952c8f..228d791 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -18,11 +18,11 @@
# bug-gdb@prep.ai.mit.edu
# tests for namespaces
-# Written by Satish Pai <pai@apollo.hp.com> 1997-07-23
+# Originally written by Satish Pai <pai@apollo.hp.com> 1997-07-23
# This file is part of the gdb testsuite
-# Note: These tests are geared to the HP aCC compiler,
+# Note: The original tests were geared to the HP aCC compiler,
# which has an idiosyncratic way of emitting debug info
# for namespaces.
# Note: As of 2000-06-03, these pass under g++ - djb
@@ -84,6 +84,11 @@ gdb_test "up" ".*main.*" "up from marker1"
# Access a data item inside a namespace using colons and
# single quotes :-(
+# NOTE: carlton/2003-09-24: the quotes are becoming less necessary (or
+# even desirable.) For tests where it should still work with quotes,
+# I'm including versions both with and without quotes; for tests that
+# shouldn't work with quotes, I'm only including one version.
+
send_gdb "print 'AAA::c'\n"
gdb_expect {
-re "\\$\[0-9\]* = 0 '\\\\(0|000)'\r\n$gdb_prompt $" { pass "print 'AAA::c'" }
@@ -91,6 +96,13 @@ gdb_expect {
timeout { fail "(timeout) print 'AAA::c'" }
}
+send_gdb "print AAA::c\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 0 '\\\\(0|000)'\r\n$gdb_prompt $" { pass "print AAA::c" }
+ -re ".*$gdb_prompt $" { fail "print AAA::c" }
+ timeout { fail "(timeout) print AAA::c" }
+}
+
# An object declared using "using".
send_gdb "print ina\n"
@@ -137,6 +149,15 @@ gdb_expect {
timeout { fail "(timeout) print 'AAA::xyzq'('x')" }
}
+send_gdb "print AAA::xyzq('x')\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 97 'a'\r\n$gdb_prompt $" {
+ pass "print AAA::xyzq('x')"
+ }
+ -re ".*$gdb_prompt $" { fail "print AAA::xyzq('x')" }
+ timeout { fail "(timeout) print AAA::xyzq('x')" }
+}
+
# Break on a function in a namespace
send_gdb "break AAA::xyzq\n"
@@ -159,6 +180,15 @@ gdb_expect {
timeout { fail "(timeout) print 'BBB::CCC::xyzq'('x')" }
}
+send_gdb "print BBB::CCC::xyzq('x')\n"
+gdb_expect {
+ -re "\\$\[0-9\]* = 122 'z'\r\n$gdb_prompt $" {
+ pass "print BBB::CCC::xyzq('x')"
+ }
+ -re ".*$gdb_prompt $" { fail "print BBB::CCC::xyzq('x')" }
+ timeout { fail "(timeout) print BBB::CCC::xyzq('x')" }
+}
+
# Break on a function in a nested namespace
send_gdb "break BBB::CCC::xyzq\n"
@@ -204,9 +234,13 @@ if ![runto "C::D::marker2"] then {
gdb_test "print c" "\\$\[0-9\].* = 1"
gdb_test "print cc" "No symbol \"cc\" in current context."
gdb_test "print 'C::cc'" "\\$\[0-9\].* = 2"
+gdb_test "print C::cc" "\\$\[0-9\].* = 2"
gdb_test "print cd" "\\$\[0-9\].* = 3"
+gdb_test "print C::D::cd" "No type \"D\" in namespace \"C::C\"."
gdb_test "print 'E::cde'" "\\$\[0-9\].* = 5"
+gdb_test "print E::cde" "\\$\[0-9\].* = 5"
gdb_test "print shadow" "\\$\[0-9\].* = 13"
+gdb_test "print E::ce" "No symbol \"ce\" in namespace \"C::D::E\"."
gdb_test "print cOtherFile" "\\$\[0-9\].* = 316"
gdb_test "ptype C" "type = namespace C::C"
gdb_test "ptype E" "type = namespace C::D::E"
@@ -215,7 +249,11 @@ gdb_test "ptype E" "type = namespace C::D::E"
gdb_test "print cX" "\\$\[0-9\].* = 6"
gdb_test "print 'F::cXf'" "\\$\[0-9\].* = 7"
+gdb_test "print F::cXf" "\\$\[0-9\].* = 7"
+gdb_test "print F::cXfX" "\\$\[0-9\].* = 8"
gdb_test "print X" "\\$\[0-9\].* = 9"
gdb_test "print 'G::Xg'" "\\$\[0-9\].* = 10"
+gdb_test "print G::Xg" "\\$\[0-9\].* = 10"
+gdb_test "print G::XgX" "\\$\[0-9\].* = 11"
gdb_test "print cXOtherFile" "No symbol \"cXOtherFile\" in current context."
gdb_test "print XOtherFile" "No symbol \"XOtherFile\" in current context."