|
|
861f93 |
archer archer-keiths-expr-cumulative
|
|
|
861f93 |
b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc
|
|
|
861f93 |
|
|
|
861f93 |
--- /dev/null 2011-01-12 06:28:36.282000001 +0100
|
|
|
861f93 |
+++ ./gdb/testsuite/gdb.cp/namespace-nested-imports.cc 2009-09-25 06:50:38.000000000 +0200
|
|
|
861f93 |
@@ -0,0 +1,36 @@
|
|
|
861f93 |
+namespace A
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ namespace B
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ int ab = 11;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+namespace C
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ namespace D
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ using namespace A::B;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ int
|
|
|
861f93 |
+ second()
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ ab;
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+
|
|
|
861f93 |
+ int
|
|
|
861f93 |
+ first()
|
|
|
861f93 |
+ {
|
|
|
861f93 |
+ //ab;
|
|
|
861f93 |
+ return D::second();
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+int
|
|
|
861f93 |
+main()
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ //ab;
|
|
|
861f93 |
+ return C::first();
|
|
|
861f93 |
+}
|
|
|
861f93 |
--- /dev/null 2011-01-12 06:28:36.282000001 +0100
|
|
|
861f93 |
+++ ./gdb/testsuite/gdb.cp/namespace-nested-imports.exp 2009-09-25 06:50:38.000000000 +0200
|
|
|
861f93 |
@@ -0,0 +1,50 @@
|
|
|
861f93 |
+# Copyright 2008 Free Software Foundation, Inc.
|
|
|
861f93 |
+
|
|
|
861f93 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
861f93 |
+# it under the terms of the GNU General Public License as published by
|
|
|
861f93 |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
861f93 |
+# (at your option) any later version.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# This program is distributed in the hope that it will be useful,
|
|
|
861f93 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
861f93 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
861f93 |
+# GNU General Public License for more details.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# You should have received a copy of the GNU General Public License
|
|
|
861f93 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
861f93 |
+
|
|
|
861f93 |
+set testfile namespace-nested-imports
|
|
|
861f93 |
+set srcfile ${testfile}.cc
|
|
|
861f93 |
+set binfile ${objdir}/${subdir}/${testfile}
|
|
|
861f93 |
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
|
|
861f93 |
+ untested "Couldn't compile test program"
|
|
|
861f93 |
+ return -1
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+# Get things started.
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_exit
|
|
|
861f93 |
+gdb_start
|
|
|
861f93 |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
861f93 |
+gdb_load ${binfile}
|
|
|
861f93 |
+
|
|
|
861f93 |
+############################################
|
|
|
861f93 |
+if ![runto_main] then {
|
|
|
861f93 |
+ perror "couldn't run to breakpoint main"
|
|
|
861f93 |
+ continue
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print ab" "No symbol .* in current context."
|
|
|
861f93 |
+
|
|
|
861f93 |
+############################################
|
|
|
861f93 |
+gdb_breakpoint C::first
|
|
|
861f93 |
+gdb_continue_to_breakpoint "C::first"
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print ab" "No symbol .* in current context."
|
|
|
861f93 |
+gdb_test "print C::D::ab" "= 11"
|
|
|
861f93 |
+
|
|
|
861f93 |
+############################################
|
|
|
861f93 |
+gdb_breakpoint C::D::second
|
|
|
861f93 |
+gdb_continue_to_breakpoint "C::D::second"
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print ab" "= 11"
|
|
|
861f93 |
--- /dev/null 2011-01-12 06:28:36.282000001 +0100
|
|
|
861f93 |
+++ ./gdb/testsuite/gdb.cp/namespace-no-imports.cc 2009-09-25 06:50:38.000000000 +0200
|
|
|
861f93 |
@@ -0,0 +1,37 @@
|
|
|
861f93 |
+
|
|
|
861f93 |
+namespace A
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ int _a = 11;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ namespace B{
|
|
|
861f93 |
+
|
|
|
861f93 |
+ int ab = 22;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ namespace C{
|
|
|
861f93 |
+
|
|
|
861f93 |
+ int abc = 33;
|
|
|
861f93 |
+
|
|
|
861f93 |
+ int second(){
|
|
|
861f93 |
+ return 0;
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+
|
|
|
861f93 |
+ int first(){
|
|
|
861f93 |
+ _a;
|
|
|
861f93 |
+ ab;
|
|
|
861f93 |
+ C::abc;
|
|
|
861f93 |
+ return C::second();
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+ }
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+
|
|
|
861f93 |
+int
|
|
|
861f93 |
+main()
|
|
|
861f93 |
+{
|
|
|
861f93 |
+ A::_a;
|
|
|
861f93 |
+ A::B::ab;
|
|
|
861f93 |
+ A::B::C::abc;
|
|
|
861f93 |
+ return A::B::first();
|
|
|
861f93 |
+}
|
|
|
861f93 |
--- /dev/null 2011-01-12 06:28:36.282000001 +0100
|
|
|
861f93 |
+++ ./gdb/testsuite/gdb.cp/namespace-no-imports.exp 2009-09-25 06:50:38.000000000 +0200
|
|
|
861f93 |
@@ -0,0 +1,69 @@
|
|
|
861f93 |
+# Copyright 2008 Free Software Foundation, Inc.
|
|
|
861f93 |
+
|
|
|
861f93 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
861f93 |
+# it under the terms of the GNU General Public License as published by
|
|
|
861f93 |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
861f93 |
+# (at your option) any later version.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# This program is distributed in the hope that it will be useful,
|
|
|
861f93 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
861f93 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
861f93 |
+# GNU General Public License for more details.
|
|
|
861f93 |
+#
|
|
|
861f93 |
+# You should have received a copy of the GNU General Public License
|
|
|
861f93 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
861f93 |
+
|
|
|
861f93 |
+set testfile namespace-no-imports
|
|
|
861f93 |
+set srcfile ${testfile}.cc
|
|
|
861f93 |
+set binfile ${objdir}/${subdir}/${testfile}
|
|
|
861f93 |
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
|
|
861f93 |
+ untested "Couldn't compile test program"
|
|
|
861f93 |
+ return -1
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+# Get things started.
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_exit
|
|
|
861f93 |
+gdb_start
|
|
|
861f93 |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
861f93 |
+gdb_load ${binfile}
|
|
|
861f93 |
+
|
|
|
861f93 |
+############################################
|
|
|
861f93 |
+if ![runto_main] then {
|
|
|
861f93 |
+ perror "couldn't run to breakpoint main"
|
|
|
861f93 |
+ continue
|
|
|
861f93 |
+}
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print A::_a" "= 11"
|
|
|
861f93 |
+gdb_test "print A::B::ab" "= 22"
|
|
|
861f93 |
+gdb_test "print A::B::C::abc" "= 33"
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print _a" "No symbol .* in current context."
|
|
|
861f93 |
+gdb_test "print ab" "No symbol .* in current context."
|
|
|
861f93 |
+gdb_test "print abc" "No symbol .* in current context."
|
|
|
861f93 |
+
|
|
|
861f93 |
+############################################
|
|
|
861f93 |
+gdb_breakpoint A::B::first
|
|
|
861f93 |
+gdb_continue_to_breakpoint "A::B::first"
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print A::_a" "= 11"
|
|
|
861f93 |
+gdb_test "print A::B::ab" "= 22"
|
|
|
861f93 |
+gdb_test "print A::B::C::abc" "= 33"
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print _a" "= 11"
|
|
|
861f93 |
+gdb_test "print ab" "= 22"
|
|
|
861f93 |
+gdb_test "print C::abc" "= 33"
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print abc" "No symbol .* in current context."
|
|
|
861f93 |
+
|
|
|
861f93 |
+############################################
|
|
|
861f93 |
+gdb_breakpoint A::B::C::second
|
|
|
861f93 |
+gdb_continue_to_breakpoint "A::B::C::second"
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print A::_a" "= 11"
|
|
|
861f93 |
+gdb_test "print A::B::ab" "= 22"
|
|
|
861f93 |
+gdb_test "print A::B::C::abc" "= 33"
|
|
|
861f93 |
+
|
|
|
861f93 |
+gdb_test "print _a" "= 11"
|
|
|
861f93 |
+gdb_test "print ab" "= 22"
|
|
|
861f93 |
+gdb_test "print abc" "= 33"
|