summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2read.c5
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.cp/namespace.cc6
-rw-r--r--gdb/testsuite/gdb.cp/namespace.exp9
5 files changed, 29 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b34eb93a8d0..84f6736fe8d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-19 Tom Tromey <tromey@redhat.com>
+
+ PR c++/8000:
+ * dwarf2read.c (partial_die_parent_scope): Put enumeration type
+ into parent scope, and enumerator into grandparent scope.
+
2010-01-19 Joel Brobecker <brobecker@adacore.com>
* NEWS: Add entry for "set/show ada trust-PAD-over-XVS" commands.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 4903ac4a0b5..db516539029 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2386,7 +2386,8 @@ partial_die_parent_scope (struct partial_die_info *pdi,
|| parent->tag == DW_TAG_structure_type
|| parent->tag == DW_TAG_class_type
|| parent->tag == DW_TAG_interface_type
- || parent->tag == DW_TAG_union_type)
+ || parent->tag == DW_TAG_union_type
+ || parent->tag == DW_TAG_enumeration_type)
{
if (grandparent_scope == NULL)
parent->scope = parent->name;
@@ -2394,7 +2395,7 @@ partial_die_parent_scope (struct partial_die_info *pdi,
parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope,
parent->name, cu);
}
- else if (parent->tag == DW_TAG_enumeration_type)
+ else if (parent->tag == DW_TAG_enumerator)
/* Enumerators should not get the name of the enumeration as a prefix. */
parent->scope = grandparent_scope;
else
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9c3dc8084c0..e302bcb22d7 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2010-01-19 Tom Tromey <tromey@redhat.com>
+
+ PR c++/8000:
+ * gdb.cp/namespace.exp: Use new enum. Fix line numbers in
+ existing tests.
+ * gdb.cp/namespace.cc (AAA::SomeEnum): New enum.
+ (main): Use AAA::SomeEnum.
+
2010-01-19 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.mi/mi-break.exp (set line_callme_head, set line_callme_body): New.
diff --git a/gdb/testsuite/gdb.cp/namespace.cc b/gdb/testsuite/gdb.cp/namespace.cc
index 4ac918764cc..f918b63de93 100644
--- a/gdb/testsuite/gdb.cp/namespace.cc
+++ b/gdb/testsuite/gdb.cp/namespace.cc
@@ -8,6 +8,11 @@ namespace AAA {
int xx;
int fum (int);
};
+ enum SomeEnum {
+ ALPHA,
+ BETA,
+ DELTA
+ };
};
int AAA::inA::fum (int i)
@@ -174,6 +179,7 @@ int main ()
{
using AAA::inA;
char c1;
+ AAA::SomeEnum var = AAA::ALPHA;
using namespace BBB;
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index a2b8242e8c4..4362fd840f6 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -164,7 +164,7 @@ gdb_expect {
# Break on a function in a namespace
gdb_test "break AAA::xyzq" \
- "Breakpoint.*at $hex: file.*namespace.cc, line 42\\."
+ "Breakpoint.*at $hex: file.*namespace.cc, line 47\\."
# Call a function in a nested namespace
@@ -189,7 +189,7 @@ gdb_expect {
# Break on a function in a nested namespace
gdb_test "break BBB::CCC::xyzq" \
- "Breakpoint.*at $hex: file.*namespace.cc, line 58\\."
+ "Breakpoint.*at $hex: file.*namespace.cc, line 63\\."
# Print address of a function in a class in a namespace
@@ -214,7 +214,7 @@ gdb_expect {
# Break on a function in a class in a namespace
gdb_test "break BBB::Class::xyzq" \
- "Breakpoint.*at $hex: file.*namespace.cc, line 63\\."
+ "Breakpoint.*at $hex: file.*namespace.cc, line 68\\."
# Test to see if the appropriate namespaces are in scope when trying
# to print out stuff from within a function defined within a
@@ -271,3 +271,6 @@ 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."
+
+# Enum tests.
+gdb_test "print AAA::ALPHA" "\\$\[0-9\].* = AAA::ALPHA"