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

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