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