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