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

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