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

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