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

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