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