]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | 2005-07-26 Jeff Johnston <jjohnstn@redhat.com> |
2 | ||
3 | * gdb.cp/b146835.exp: New testcase. | |
4 | * gdb.cp/b146835.cc: Ditto. | |
5 | * gdb.cp/b146835b.cc: Ditto. | |
6 | * gdb.cp/b146835.h: Ditto. | |
7 | ||
7566401a ER |
8 | Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835b.cc |
9 | =================================================================== | |
10 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
11 | +++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835b.cc 2009-08-12 06:07:50.000000000 +0200 | |
3a58abaf AM |
12 | @@ -0,0 +1,11 @@ |
13 | +#include "b146835.h" | |
14 | + | |
15 | +C::C() { d = 0; x = 3; } | |
16 | + | |
17 | +int C::z (char *s) { return 0; } | |
18 | + | |
19 | +C::~C() {} | |
20 | + | |
21 | +void A::funcD (class E *e, class D *d) {} | |
22 | +void A::funcE (E *e, D *d) {} | |
23 | +void A::funcF (unsigned long x, D *d) {} | |
7566401a ER |
24 | Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.cc |
25 | =================================================================== | |
26 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
27 | +++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.cc 2009-08-12 06:07:50.000000000 +0200 | |
3a58abaf AM |
28 | @@ -0,0 +1,32 @@ |
29 | +#include "b146835.h" | |
30 | +#include <iostream> | |
31 | + | |
32 | +class F : public C { | |
33 | + | |
34 | +protected: | |
35 | + | |
36 | + virtual void funcA (unsigned long a, B *b); | |
37 | + virtual void funcB (E *e); | |
38 | + virtual void funcC (unsigned long x, bool y); | |
39 | + | |
40 | + char *s1, *s2; | |
41 | + bool b1; | |
42 | + int k; | |
43 | + | |
44 | +public: | |
45 | + void foo() { | |
46 | + std::cout << "foo" << std::endl; | |
47 | + } | |
48 | +}; | |
49 | + | |
50 | + | |
51 | +void F::funcA (unsigned long a, B *b) {} | |
52 | +void F::funcB (E *e) {} | |
53 | +void F::funcC (unsigned long x, bool y) {} | |
54 | + | |
55 | +int main() | |
56 | +{ | |
57 | + F f; | |
58 | + f.foo(); | |
59 | +} | |
60 | + | |
7566401a ER |
61 | Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp |
62 | =================================================================== | |
63 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
64 | +++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp 2009-08-12 06:58:28.000000000 +0200 | |
51a5ef0f | 65 | @@ -0,0 +1,47 @@ |
3a58abaf AM |
66 | +# This testcase is part of GDB, the GNU debugger. |
67 | + | |
68 | +# Copyright 2005 Free Software Foundation, Inc. | |
69 | + | |
70 | +# This program is free software; you can redistribute it and/or modify | |
71 | +# it under the terms of the GNU General Public License as published by | |
72 | +# the Free Software Foundation; either version 2 of the License, or | |
73 | +# (at your option) any later version. | |
74 | +# | |
75 | +# This program is distributed in the hope that it will be useful, | |
76 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
77 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
78 | +# GNU General Public License for more details. | |
79 | +# | |
80 | +# You should have received a copy of the GNU General Public License | |
81 | +# along with this program; if not, write to the Free Software | |
82 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
83 | + | |
84 | +# Check that GDB can properly print an inherited member variable | |
85 | +# (Bugzilla 146835) | |
86 | + | |
3a58abaf AM |
87 | +set testfile "b146835" |
88 | +set srcfile ${testfile}.cc | |
89 | +set srcfile2 ${testfile}b.cc | |
90 | +set binfile ${objdir}/${subdir}/${testfile} | |
91 | +if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable {debug c++}] != "" } { | |
92 | + return -1 | |
93 | +} | |
94 | + | |
95 | +gdb_exit | |
96 | +gdb_start | |
97 | +gdb_reinitialize_dir $srcdir/$subdir | |
98 | +gdb_load ${binfile} | |
99 | + | |
100 | +# | |
101 | +# Run to `main' where we begin our tests. | |
102 | +# | |
103 | + | |
104 | +if ![runto_main] then { | |
105 | + gdb_suppress_tests | |
106 | +} | |
107 | + | |
108 | +gdb_test "break 'F::foo()'" "" | |
109 | +gdb_continue_to_breakpoint "First line foo" | |
110 | + | |
111 | +# Verify that we can access the inherited member d | |
7566401a ER |
112 | +gdb_test "p d" " = \\(D \\*\\) *0x0" "Verify inherited member d accessible" |
113 | Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.h | |
114 | =================================================================== | |
115 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | |
116 | +++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.h 2009-08-12 06:07:50.000000000 +0200 | |
3a58abaf AM |
117 | @@ -0,0 +1,36 @@ |
118 | + | |
119 | +class A { | |
120 | + | |
121 | +protected: | |
122 | + | |
123 | + virtual void funcA (unsigned long a, class B *b) = 0; | |
124 | + virtual void funcB (class E *e) = 0; | |
125 | + virtual void funcC (unsigned long x, bool y) = 0; | |
126 | + | |
127 | + void funcD (class E *e, class D* d); | |
128 | + virtual void funcE (E *e, D *d); | |
129 | + virtual void funcF (unsigned long x, D *d); | |
130 | +}; | |
131 | + | |
132 | + | |
133 | +class C : public A { | |
134 | + | |
135 | +protected: | |
136 | + | |
137 | + int x; | |
138 | + class K *k; | |
139 | + class H *h; | |
140 | + | |
141 | + D *d; | |
142 | + | |
143 | + class W *w; | |
144 | + class N *n; | |
145 | + class L *l; | |
146 | + unsigned long *r; | |
147 | + | |
148 | +public: | |
149 | + | |
150 | + C(); | |
151 | + int z (char *s); | |
152 | + virtual ~C(); | |
153 | +}; |