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