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