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

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