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

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