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

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