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

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