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

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