|
|
79b363 |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
79b363 |
From: Fedora GDB patches <invalid@email.com>
|
|
|
79b363 |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
79b363 |
Subject: gdb-test-expr-cumulative-archer.patch
|
|
|
79b363 |
|
|
|
79b363 |
;; [archer-keiths-expr-cumulative+upstream] Import C++ testcases.
|
|
|
79b363 |
;;=fedoratest
|
|
|
79b363 |
|
|
|
79b363 |
archer archer-keiths-expr-cumulative
|
|
|
79b363 |
b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc
|
|
|
79b363 |
|
|
|
79b363 |
diff --git a/gdb/testsuite/gdb.cp/namespace-nested-imports.cc b/gdb/testsuite/gdb.cp/namespace-nested-imports.cc
|
|
|
79b363 |
new file mode 100644
|
|
|
79b363 |
--- /dev/null
|
|
|
79b363 |
+++ b/gdb/testsuite/gdb.cp/namespace-nested-imports.cc
|
|
|
79b363 |
@@ -0,0 +1,36 @@
|
|
|
79b363 |
+namespace A
|
|
|
79b363 |
+{
|
|
|
79b363 |
+ namespace B
|
|
|
79b363 |
+ {
|
|
|
79b363 |
+ int ab = 11;
|
|
|
79b363 |
+ }
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+namespace C
|
|
|
79b363 |
+{
|
|
|
79b363 |
+ namespace D
|
|
|
79b363 |
+ {
|
|
|
79b363 |
+ using namespace A::B;
|
|
|
79b363 |
+
|
|
|
79b363 |
+ int
|
|
|
79b363 |
+ second()
|
|
|
79b363 |
+ {
|
|
|
79b363 |
+ ab;
|
|
|
79b363 |
+ return 0;
|
|
|
79b363 |
+ }
|
|
|
79b363 |
+ }
|
|
|
79b363 |
+
|
|
|
79b363 |
+ int
|
|
|
79b363 |
+ first()
|
|
|
79b363 |
+ {
|
|
|
79b363 |
+ //ab;
|
|
|
79b363 |
+ return D::second();
|
|
|
79b363 |
+ }
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+int
|
|
|
79b363 |
+main()
|
|
|
79b363 |
+{
|
|
|
79b363 |
+ //ab;
|
|
|
79b363 |
+ return C::first();
|
|
|
79b363 |
+}
|
|
|
79b363 |
diff --git a/gdb/testsuite/gdb.cp/namespace-nested-imports.exp b/gdb/testsuite/gdb.cp/namespace-nested-imports.exp
|
|
|
79b363 |
new file mode 100644
|
|
|
79b363 |
--- /dev/null
|
|
|
79b363 |
+++ b/gdb/testsuite/gdb.cp/namespace-nested-imports.exp
|
|
|
79b363 |
@@ -0,0 +1,50 @@
|
|
|
79b363 |
+# Copyright 2008 Free Software Foundation, Inc.
|
|
|
79b363 |
+
|
|
|
79b363 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
79b363 |
+# it under the terms of the GNU General Public License as published by
|
|
|
79b363 |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
79b363 |
+# (at your option) any later version.
|
|
|
79b363 |
+#
|
|
|
79b363 |
+# This program is distributed in the hope that it will be useful,
|
|
|
79b363 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
79b363 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
79b363 |
+# GNU General Public License for more details.
|
|
|
79b363 |
+#
|
|
|
79b363 |
+# You should have received a copy of the GNU General Public License
|
|
|
79b363 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
79b363 |
+
|
|
|
79b363 |
+set testfile namespace-nested-imports
|
|
|
79b363 |
+set srcfile ${testfile}.cc
|
|
|
79b363 |
+set binfile [standard_output_file ${testfile}]
|
|
|
79b363 |
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
|
|
79b363 |
+ untested "Couldn't compile test program"
|
|
|
79b363 |
+ return -1
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+# Get things started.
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_exit
|
|
|
79b363 |
+gdb_start
|
|
|
79b363 |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
79b363 |
+gdb_load ${binfile}
|
|
|
79b363 |
+
|
|
|
79b363 |
+############################################
|
|
|
79b363 |
+if ![runto_main] then {
|
|
|
79b363 |
+ perror "couldn't run to breakpoint main"
|
|
|
79b363 |
+ continue
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print ab" "No symbol .* in current context."
|
|
|
79b363 |
+
|
|
|
79b363 |
+############################################
|
|
|
79b363 |
+gdb_breakpoint C::first
|
|
|
79b363 |
+gdb_continue_to_breakpoint "C::first"
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print ab" "No symbol .* in current context."
|
|
|
79b363 |
+gdb_test "print C::D::ab" "= 11"
|
|
|
79b363 |
+
|
|
|
79b363 |
+############################################
|
|
|
79b363 |
+gdb_breakpoint C::D::second
|
|
|
79b363 |
+gdb_continue_to_breakpoint "C::D::second"
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print ab" "= 11"
|
|
|
79b363 |
diff --git a/gdb/testsuite/gdb.cp/namespace-no-imports.cc b/gdb/testsuite/gdb.cp/namespace-no-imports.cc
|
|
|
79b363 |
new file mode 100644
|
|
|
79b363 |
--- /dev/null
|
|
|
79b363 |
+++ b/gdb/testsuite/gdb.cp/namespace-no-imports.cc
|
|
|
79b363 |
@@ -0,0 +1,37 @@
|
|
|
79b363 |
+
|
|
|
79b363 |
+namespace A
|
|
|
79b363 |
+{
|
|
|
79b363 |
+ int _a = 11;
|
|
|
79b363 |
+
|
|
|
79b363 |
+ namespace B{
|
|
|
79b363 |
+
|
|
|
79b363 |
+ int ab = 22;
|
|
|
79b363 |
+
|
|
|
79b363 |
+ namespace C{
|
|
|
79b363 |
+
|
|
|
79b363 |
+ int abc = 33;
|
|
|
79b363 |
+
|
|
|
79b363 |
+ int second(){
|
|
|
79b363 |
+ return 0;
|
|
|
79b363 |
+ }
|
|
|
79b363 |
+
|
|
|
79b363 |
+ }
|
|
|
79b363 |
+
|
|
|
79b363 |
+ int first(){
|
|
|
79b363 |
+ _a;
|
|
|
79b363 |
+ ab;
|
|
|
79b363 |
+ C::abc;
|
|
|
79b363 |
+ return C::second();
|
|
|
79b363 |
+ }
|
|
|
79b363 |
+ }
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+
|
|
|
79b363 |
+int
|
|
|
79b363 |
+main()
|
|
|
79b363 |
+{
|
|
|
79b363 |
+ A::_a;
|
|
|
79b363 |
+ A::B::ab;
|
|
|
79b363 |
+ A::B::C::abc;
|
|
|
79b363 |
+ return A::B::first();
|
|
|
79b363 |
+}
|
|
|
79b363 |
diff --git a/gdb/testsuite/gdb.cp/namespace-no-imports.exp b/gdb/testsuite/gdb.cp/namespace-no-imports.exp
|
|
|
79b363 |
new file mode 100644
|
|
|
79b363 |
--- /dev/null
|
|
|
79b363 |
+++ b/gdb/testsuite/gdb.cp/namespace-no-imports.exp
|
|
|
79b363 |
@@ -0,0 +1,69 @@
|
|
|
79b363 |
+# Copyright 2008 Free Software Foundation, Inc.
|
|
|
79b363 |
+
|
|
|
79b363 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
79b363 |
+# it under the terms of the GNU General Public License as published by
|
|
|
79b363 |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
79b363 |
+# (at your option) any later version.
|
|
|
79b363 |
+#
|
|
|
79b363 |
+# This program is distributed in the hope that it will be useful,
|
|
|
79b363 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
79b363 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
79b363 |
+# GNU General Public License for more details.
|
|
|
79b363 |
+#
|
|
|
79b363 |
+# You should have received a copy of the GNU General Public License
|
|
|
79b363 |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
79b363 |
+
|
|
|
79b363 |
+set testfile namespace-no-imports
|
|
|
79b363 |
+set srcfile ${testfile}.cc
|
|
|
79b363 |
+set binfile [standard_output_file ${testfile}]
|
|
|
79b363 |
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
|
|
79b363 |
+ untested "Couldn't compile test program"
|
|
|
79b363 |
+ return -1
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+# Get things started.
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_exit
|
|
|
79b363 |
+gdb_start
|
|
|
79b363 |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
79b363 |
+gdb_load ${binfile}
|
|
|
79b363 |
+
|
|
|
79b363 |
+############################################
|
|
|
79b363 |
+if ![runto_main] then {
|
|
|
79b363 |
+ perror "couldn't run to breakpoint main"
|
|
|
79b363 |
+ continue
|
|
|
79b363 |
+}
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print A::_a" "= 11"
|
|
|
79b363 |
+gdb_test "print A::B::ab" "= 22"
|
|
|
79b363 |
+gdb_test "print A::B::C::abc" "= 33"
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print _a" "No symbol .* in current context."
|
|
|
79b363 |
+gdb_test "print ab" "No symbol .* in current context."
|
|
|
79b363 |
+gdb_test "print abc" "No symbol .* in current context."
|
|
|
79b363 |
+
|
|
|
79b363 |
+############################################
|
|
|
79b363 |
+gdb_breakpoint A::B::first
|
|
|
79b363 |
+gdb_continue_to_breakpoint "A::B::first"
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print A::_a" "= 11"
|
|
|
79b363 |
+gdb_test "print A::B::ab" "= 22"
|
|
|
79b363 |
+gdb_test "print A::B::C::abc" "= 33"
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print _a" "= 11"
|
|
|
79b363 |
+gdb_test "print ab" "= 22"
|
|
|
79b363 |
+gdb_test "print C::abc" "= 33"
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print abc" "No symbol .* in current context."
|
|
|
79b363 |
+
|
|
|
79b363 |
+############################################
|
|
|
79b363 |
+gdb_breakpoint A::B::C::second
|
|
|
79b363 |
+gdb_continue_to_breakpoint "A::B::C::second"
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print A::_a" "= 11"
|
|
|
79b363 |
+gdb_test "print A::B::ab" "= 22"
|
|
|
79b363 |
+gdb_test "print A::B::C::abc" "= 33"
|
|
|
79b363 |
+
|
|
|
79b363 |
+gdb_test "print _a" "= 11"
|
|
|
79b363 |
+gdb_test "print ab" "= 22"
|
|
|
79b363 |
+gdb_test "print abc" "= 33"
|