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

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