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

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