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

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