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