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

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