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

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