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