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