Blame SOURCES/gdb-test-expr-cumulative-archer.patch

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