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

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