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

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