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

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