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

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