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

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