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