Blame SOURCES/gdb-6.3-inheritancetest-20050726.patch

405ea9
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
405ea9
From: Jeff Johnston <jjohnstn@redhat.com>
405ea9
Date: Fri, 27 Oct 2017 21:07:50 +0200
405ea9
Subject: gdb-6.3-inheritancetest-20050726.patch
405ea9
405ea9
;; Verify printing of inherited members test
405ea9
;;=fedoratest
405ea9
405ea9
2005-07-26  Jeff Johnston  <jjohnstn@redhat.com>
405ea9
405ea9
	* gdb.cp/b146835.exp: New testcase.
405ea9
	* gdb.cp/b146835.cc: Ditto.
405ea9
	* gdb.cp/b146835b.cc: Ditto.
405ea9
	* gdb.cp/b146835.h: Ditto.
405ea9
405ea9
diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc
405ea9
new file mode 100644
405ea9
--- /dev/null
405ea9
+++ b/gdb/testsuite/gdb.cp/b146835.cc
405ea9
@@ -0,0 +1,31 @@
405ea9
+#include "b146835.h"
405ea9
+#include <iostream>
405ea9
+
405ea9
+class F : public C {
405ea9
+
405ea9
+protected:
405ea9
+
405ea9
+   virtual void funcA (unsigned long a, B *b);
405ea9
+   virtual void funcB (E *e);
405ea9
+   virtual void funcC (unsigned long x, bool y);
405ea9
+
405ea9
+   char *s1, *s2;
405ea9
+   bool b1;
405ea9
+   int k;
405ea9
+
405ea9
+public:
405ea9
+   void foo() {
405ea9
+       std::cout << "foo" << std::endl;
405ea9
+   }
405ea9
+};
405ea9
+
405ea9
+
405ea9
+void F::funcA (unsigned long a, B *b) {}
405ea9
+void F::funcB (E *e) {}
405ea9
+void F::funcC (unsigned long x, bool y) {}
405ea9
+
405ea9
+int  main()
405ea9
+{
405ea9
+   F f;
405ea9
+   f.foo();
405ea9
+}
405ea9
diff --git a/gdb/testsuite/gdb.cp/b146835.exp b/gdb/testsuite/gdb.cp/b146835.exp
405ea9
new file mode 100644
405ea9
--- /dev/null
405ea9
+++ b/gdb/testsuite/gdb.cp/b146835.exp
405ea9
@@ -0,0 +1,47 @@
405ea9
+# This testcase is part of GDB, the GNU debugger.
405ea9
+
405ea9
+# Copyright 2005 Free Software Foundation, Inc.
405ea9
+
405ea9
+# This program is free software; you can redistribute it and/or modify
405ea9
+# it under the terms of the GNU General Public License as published by
405ea9
+# the Free Software Foundation; either version 2 of the License, or
405ea9
+# (at your option) any later version.
405ea9
+#
405ea9
+# This program is distributed in the hope that it will be useful,
405ea9
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
405ea9
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
405ea9
+# GNU General Public License for more details.
405ea9
+#
405ea9
+# You should have received a copy of the GNU General Public License
405ea9
+# along with this program; if not, write to the Free Software
405ea9
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
405ea9
+
405ea9
+# Check that GDB can properly print an inherited member variable
405ea9
+# (Bugzilla 146835)
405ea9
+
405ea9
+set testfile "b146835"
405ea9
+set srcfile ${testfile}.cc
405ea9
+set srcfile2 ${testfile}b.cc
405ea9
+set binfile [standard_output_file ${testfile}]
405ea9
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable {debug c++}] != "" } {
405ea9
+    return -1
405ea9
+}
405ea9
+
405ea9
+gdb_exit
405ea9
+gdb_start
405ea9
+gdb_reinitialize_dir $srcdir/$subdir
405ea9
+gdb_load ${binfile}
405ea9
+
405ea9
+#
405ea9
+# Run to `main' where we begin our tests.
405ea9
+#
405ea9
+
405ea9
+if ![runto_main] then {
405ea9
+    gdb_suppress_tests
405ea9
+}
405ea9
+
405ea9
+gdb_test "break 'F::foo()'" ""
405ea9
+gdb_continue_to_breakpoint "First line foo"
405ea9
+
405ea9
+# Verify that we can access the inherited member d
405ea9
+gdb_test "p d" " = \\(D \\*\\) *0x0" "Verify inherited member d accessible"
405ea9
diff --git a/gdb/testsuite/gdb.cp/b146835.h b/gdb/testsuite/gdb.cp/b146835.h
405ea9
new file mode 100644
405ea9
--- /dev/null
405ea9
+++ b/gdb/testsuite/gdb.cp/b146835.h
405ea9
@@ -0,0 +1,36 @@
405ea9
+
405ea9
+class A {
405ea9
+
405ea9
+protected:
405ea9
+
405ea9
+   virtual void funcA (unsigned long a, class B *b) = 0;
405ea9
+   virtual void funcB (class E *e) = 0;
405ea9
+   virtual void funcC (unsigned long x, bool y) = 0;
405ea9
+
405ea9
+   void funcD (class E *e, class D* d);
405ea9
+   virtual void funcE (E *e, D *d);
405ea9
+   virtual void funcF (unsigned long x, D *d);
405ea9
+};
405ea9
+
405ea9
+
405ea9
+class C : public A {
405ea9
+
405ea9
+protected:
405ea9
+
405ea9
+   int x;
405ea9
+   class K *k;
405ea9
+   class H *h;
405ea9
+
405ea9
+   D *d;
405ea9
+
405ea9
+   class W *w;
405ea9
+   class N *n;
405ea9
+   class L *l;
405ea9
+   unsigned long *r;
405ea9
+
405ea9
+public:
405ea9
+
405ea9
+   C();
405ea9
+   int z (char *s);
405ea9
+   virtual ~C();
405ea9
+};
405ea9
diff --git a/gdb/testsuite/gdb.cp/b146835b.cc b/gdb/testsuite/gdb.cp/b146835b.cc
405ea9
new file mode 100644
405ea9
--- /dev/null
405ea9
+++ b/gdb/testsuite/gdb.cp/b146835b.cc
405ea9
@@ -0,0 +1,11 @@
405ea9
+#include "b146835.h"
405ea9
+
405ea9
+C::C() { d = 0; x = 3; }
405ea9
+
405ea9
+int C::z (char *s) { return 0; }
405ea9
+
405ea9
+C::~C() {}
405ea9
+
405ea9
+void A::funcD (class E *e, class D *d) {}
405ea9
+void A::funcE (E *e, D *d) {}
405ea9
+void A::funcF (unsigned long x, D *d) {}