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