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