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

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