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

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