summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2002-10-18 00:00:19 +0000
committerDavid Carlton <carlton@bactrian.org>2002-10-18 00:00:19 +0000
commit956685462c0fa2fd21c26afd2a0b0db2bbe60f71 (patch)
tree0c38f522d5424144b3fd3dad6fe75a15ea7f8c91 /gdb/testsuite
parentbcc187da038a3b880c90508d2129567899575911 (diff)
downloadgdb-956685462c0fa2fd21c26afd2a0b0db2bbe60f71.tar.gz
2002-10-16 David Carlton <carlton@math.stanford.edu>
* dwarf2read.c (dwarf_tag_name): Add DWARF 3 names. (dwarf_attr_name): Ditto. (dwarf_type_encoding_name): Ditto. (scan_partial_symbols): Descend into DW_TAG_namespace entries. (process_die): Handle DW_TAG_namespace, DW_TAG_imported_declaration, DW_TAG_imported_module. (read_namespace): New function. 2002-10-17 David Carlton <carlton@math.stanford.edu> * gdb.c++/namespace.cc: Add namespace renaming, using directives, and using declarations. * gdb.c++/namespace.exp: Add some xfails, including namespace renaming, using directives, and using declarations.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.c++/namespace.cc66
-rw-r--r--gdb/testsuite/gdb.c++/namespace.exp52
3 files changed, 120 insertions, 5 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5ca6345e15f..073f73c093c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2002-10-17 David Carlton <carlton@math.stanford.edu>
+
+ * gdb.c++/namespace.cc: Add namespace renaming, using directives,
+ and using declarations.
+ * gdb.c++/namespace.exp: Add some xfails, including namespace
+ renaming, using directives, and using declarations.
+
2002-10-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/namespace.exp: Add anonymous namespace tests.
diff --git a/gdb/testsuite/gdb.c++/namespace.cc b/gdb/testsuite/gdb.c++/namespace.cc
index c5ec895f5ef..6298b91762d 100644
--- a/gdb/testsuite/gdb.c++/namespace.cc
+++ b/gdb/testsuite/gdb.c++/namespace.cc
@@ -83,9 +83,57 @@ namespace
}
}
+namespace H
+{
+ int h = 14;
+}
+
+namespace I = H;
+
+namespace J
+{
+ int j = 15;
+}
+
+using namespace J;
+
+namespace K
+{
+ int k = 16;
+}
+
+namespace L
+{
+ using namespace K;
+}
+
+namespace O
+{
+ int o = 18;
+}
+
+namespace P
+{
+ using namespace O;
+}
+
+namespace Q
+{
+ using namespace P;
+}
+
+namespace R
+{
+ int r1 = 19;
+ int r2 = 20;
+}
+
+using R::r1;
+
namespace C
{
int c = 1;
+ int shadow = 12;
namespace
{
@@ -115,12 +163,20 @@ namespace C
namespace D
{
int cd = 3;
+ int shadow = 13;
namespace E
{
int cde = 5;
}
+ namespace M
+ {
+ int cdm = 17;
+ }
+
+ using namespace M;
+
void marker2 (void)
{
// NOTE: carlton/2002-10-11: I'm listing the expressions that I
@@ -132,6 +188,7 @@ namespace C
C::cc;
cd;
E::cde;
+ shadow;
//E::ce;
cX;
F::cXf;
@@ -139,6 +196,15 @@ namespace C
X;
G::Xg;
G::XgX;
+ I::h;
+ j;
+ L::k;
+ //k;
+ cdm;
+ Q::o;
+ //o;
+ r1;
+ //r2;
return;
}
diff --git a/gdb/testsuite/gdb.c++/namespace.exp b/gdb/testsuite/gdb.c++/namespace.exp
index 30a68fe2adf..ebe845e16e3 100644
--- a/gdb/testsuite/gdb.c++/namespace.exp
+++ b/gdb/testsuite/gdb.c++/namespace.exp
@@ -186,8 +186,8 @@ gdb_expect {
timeout { fail "(timeout) break BBB::Class::xyzq" }
}
-# Now, test to see if the appropriate namespaces are in scope when
-# trying to print out stuff from within a function defined within a
+# Test to see if the appropriate namespaces are in scope when trying
+# to print out stuff from within a function defined within a
# namespace.
if ![runto "'C::D::marker2'"] then {
@@ -202,9 +202,20 @@ gdb_test "print cd" "\\$\[0-9\].* = 3" "print cd"
gdb_test "print 'C::D::cd'" "\\$\[0-9\].* = 3" "print C::D::cd"
gdb_test "print 'E::cde'" "\\$\[0-9\].* = 5" "print E::cde"
-# FIXME: carlton/2002-10-11: It would be nice to test printing
-# "E::ce", but unfortunately GDB will print it out even though it
-# shouldn't. Oops.
+# FIXME: carlton/2002-10-17: It's somewhat accidental that we
+# currently get this one right. (Delete this comment once namespace
+# scope issues have been handled correctly!)
+
+gdb_test "print shadow" "\\$\[0-9\].* = 13" "print shadow"
+
+
+# NOTE: carlton/2002-10-17: This one won't get fixed until namespaces
+# are first-class objects.
+
+setup_xfail "*-*-*"
+gdb_test "print 'E::ce'" "No symbol \"E::ce\" in current context." "print E::ce"
+
+# Some anonymous namespace tests.
gdb_test "print cX" "\\$\[0-9\].* = 6" "print cX"
gdb_test "print 'F::cXf'" "\\$\[0-9\].* = 7" "print F::cXf"
@@ -212,3 +223,34 @@ gdb_test "print 'F::cXfX'" "\\$\[0-9\].* = 8" "print F::cXfX"
gdb_test "print X" "\\$\[0-9\].* = 9" "print X"
gdb_test "print 'G::Xg'" "\\$\[0-9\].* = 10" "print G::Xg"
gdb_test "print 'G::XgX'" "\\$\[0-9\].* = 11" "print G::XgX"
+
+# Test namespace renaming.
+
+setup_xfail "*-*-*"
+gdb_test "print 'I::h'" "\\$\[0-9\].* = 14" "print I::h"
+
+# Test using directives.
+
+# NOTE: carlton/2002-10-17: Some of these are easy, but some of these
+# have unfortunate interactions with namespace scope issues. As of
+# this writing, some of these pass, but they pass for the wrong reasons.
+
+setup_xfail "*-*-*"
+gdb_test "print j" "\\$\[0-9\].* = 15" "print j"
+setup_xfail "*-*-*"
+gdb_test "print 'L::k'" "\\$\[0-9\].* = 16" "print L::k"
+setup_xfail "*-*-*"
+gdb_test "print k" "No symbol \"k\" in current context." "print k"
+setup_xfail "*-*-*"
+gdb_test "print cdm" "\\$\[0-9\].* = 17" "print cdm"
+setup_xfail "*-*-*"
+gdb_test "print 'Q::o'" "\\$\[0-9\].* = 18" "print Q::o"
+setup_xfail "*-*-*"
+gdb_test "print o" "No symbol \"o\" in current context." "print o"
+
+# Test using declarations. I should probably test these more.
+
+setup_xfail "*-*-*"
+gdb_test "print r1" "\\$\[0-9\].* = 19" "print r1"
+setup_xfail "*-*-*"
+gdb_test "print r2" "No symbol \"r2\" in current context." "print r2"