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

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