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