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

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