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

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