aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-03-13 00:27:12 +0000
committerTom Tromey <tromey@redhat.com>2010-03-13 00:27:12 +0000
commit1c809c688364f87ba62a4c590b53d1efe0cff64e (patch)
tree6be478308b2c32a2c2bba5ca5b28dbd14b16f6fc /gdb/testsuite/gdb.cp
parente0ce539c578586fd2f9c54b703335fa064e42a22 (diff)
downloadgdb-1c809c688364f87ba62a4c590b53d1efe0cff64e.zip
gdb-1c809c688364f87ba62a4c590b53d1efe0cff64e.tar.gz
gdb-1c809c688364f87ba62a4c590b53d1efe0cff64e.tar.bz2
gdb
PR c++/9708: * dwarf2read.c (die_needs_namespace) <DW_TAG_variable>: A variable in a lexical block does not need a namespace. (new_symbol) <DW_TAG_variable>: Put extern variables on list_in_scope in all cases. gdb/testsuite PR c++/9708: * gdb.cp/m-static.exp: Add regression test. * gdb.cp/m-static.cc (method): New method. (main): Call it.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/m-static.cc11
-rw-r--r--gdb/testsuite/gdb.cp/m-static.exp5
2 files changed, 15 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.cp/m-static.cc b/gdb/testsuite/gdb.cp/m-static.cc
index 2a0b61c..7f997ef 100644
--- a/gdb/testsuite/gdb.cp/m-static.cc
+++ b/gdb/testsuite/gdb.cp/m-static.cc
@@ -15,6 +15,12 @@ protected:
public:
gnu_obj_1(antiquities a, long l) {}
+
+ long method ()
+ {
+ static bool svar = true;
+ return key2;
+ }
};
const bool gnu_obj_1::test;
@@ -70,5 +76,8 @@ int main()
test4.dummy = test4.elsewhere;
test4.dummy = 0;
- return test4.dummy; // breakpoint: constructs-done
+
+ test1.method (); // breakpoint: constructs-done
+
+ return test4.dummy;
}
diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp
index f207462..7b4e0ca 100644
--- a/gdb/testsuite/gdb.cp/m-static.exp
+++ b/gdb/testsuite/gdb.cp/m-static.exp
@@ -132,5 +132,10 @@ gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimis
# that GDB's current behavior in such situations is either consistent
# across platforms or optimal, so I'm not including one now.
+# Step into test1.method and examine the method-scoped static.
+# This is a regression test for PR 9708.
+gdb_test "step" "gnu_obj_1::method.*"
+gdb_test "print svar" " = true"
+
gdb_exit
return 0