]>
Commit | Line | Data |
---|---|---|
6ed6bacf AM |
1 | archer archer-keiths-expr-cumulative |
2 | b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc | |
3 | ||
4 | --- /dev/null 2011-01-12 06:28:36.282000001 +0100 | |
5 | +++ ./gdb/testsuite/gdb.cp/namespace-nested-imports.cc 2009-09-25 06:50:38.000000000 +0200 | |
6 | @@ -0,0 +1,36 @@ | |
7 | +namespace A | |
8 | +{ | |
9 | + namespace B | |
10 | + { | |
11 | + int ab = 11; | |
12 | + } | |
13 | +} | |
14 | + | |
15 | +namespace C | |
16 | +{ | |
17 | + namespace D | |
18 | + { | |
19 | + using namespace A::B; | |
20 | + | |
21 | + int | |
22 | + second() | |
23 | + { | |
24 | + ab; | |
25 | + return 0; | |
26 | + } | |
27 | + } | |
28 | + | |
29 | + int | |
30 | + first() | |
31 | + { | |
32 | + //ab; | |
33 | + return D::second(); | |
34 | + } | |
35 | +} | |
36 | + | |
37 | +int | |
38 | +main() | |
39 | +{ | |
40 | + //ab; | |
41 | + return C::first(); | |
42 | +} | |
43 | --- /dev/null 2011-01-12 06:28:36.282000001 +0100 | |
44 | +++ ./gdb/testsuite/gdb.cp/namespace-nested-imports.exp 2009-09-25 06:50:38.000000000 +0200 | |
45 | @@ -0,0 +1,50 @@ | |
46 | +# Copyright 2008 Free Software Foundation, Inc. | |
47 | + | |
48 | +# This program is free software; you can redistribute it and/or modify | |
49 | +# it under the terms of the GNU General Public License as published by | |
50 | +# the Free Software Foundation; either version 3 of the License, or | |
51 | +# (at your option) any later version. | |
52 | +# | |
53 | +# This program is distributed in the hope that it will be useful, | |
54 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
55 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
56 | +# GNU General Public License for more details. | |
57 | +# | |
58 | +# You should have received a copy of the GNU General Public License | |
59 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
60 | + | |
61 | +set testfile namespace-nested-imports | |
62 | +set srcfile ${testfile}.cc | |
63 | +set binfile ${objdir}/${subdir}/${testfile} | |
64 | +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { | |
65 | + untested "Couldn't compile test program" | |
66 | + return -1 | |
67 | +} | |
68 | + | |
69 | +# Get things started. | |
70 | + | |
71 | +gdb_exit | |
72 | +gdb_start | |
73 | +gdb_reinitialize_dir $srcdir/$subdir | |
74 | +gdb_load ${binfile} | |
75 | + | |
76 | +############################################ | |
77 | +if ![runto_main] then { | |
78 | + perror "couldn't run to breakpoint main" | |
79 | + continue | |
80 | +} | |
81 | + | |
82 | +gdb_test "print ab" "No symbol .* in current context." | |
83 | + | |
84 | +############################################ | |
85 | +gdb_breakpoint C::first | |
86 | +gdb_continue_to_breakpoint "C::first" | |
87 | + | |
88 | +gdb_test "print ab" "No symbol .* in current context." | |
89 | +gdb_test "print C::D::ab" "= 11" | |
90 | + | |
91 | +############################################ | |
92 | +gdb_breakpoint C::D::second | |
93 | +gdb_continue_to_breakpoint "C::D::second" | |
94 | + | |
95 | +gdb_test "print ab" "= 11" | |
96 | --- /dev/null 2011-01-12 06:28:36.282000001 +0100 | |
97 | +++ ./gdb/testsuite/gdb.cp/namespace-no-imports.cc 2009-09-25 06:50:38.000000000 +0200 | |
98 | @@ -0,0 +1,37 @@ | |
99 | + | |
100 | +namespace A | |
101 | +{ | |
102 | + int _a = 11; | |
103 | + | |
104 | + namespace B{ | |
105 | + | |
106 | + int ab = 22; | |
107 | + | |
108 | + namespace C{ | |
109 | + | |
110 | + int abc = 33; | |
111 | + | |
112 | + int second(){ | |
113 | + return 0; | |
114 | + } | |
115 | + | |
116 | + } | |
117 | + | |
118 | + int first(){ | |
119 | + _a; | |
120 | + ab; | |
121 | + C::abc; | |
122 | + return C::second(); | |
123 | + } | |
124 | + } | |
125 | +} | |
126 | + | |
127 | + | |
128 | +int | |
129 | +main() | |
130 | +{ | |
131 | + A::_a; | |
132 | + A::B::ab; | |
133 | + A::B::C::abc; | |
134 | + return A::B::first(); | |
135 | +} | |
136 | --- /dev/null 2011-01-12 06:28:36.282000001 +0100 | |
137 | +++ ./gdb/testsuite/gdb.cp/namespace-no-imports.exp 2009-09-25 06:50:38.000000000 +0200 | |
138 | @@ -0,0 +1,69 @@ | |
139 | +# Copyright 2008 Free Software Foundation, Inc. | |
140 | + | |
141 | +# This program is free software; you can redistribute it and/or modify | |
142 | +# it under the terms of the GNU General Public License as published by | |
143 | +# the Free Software Foundation; either version 3 of the License, or | |
144 | +# (at your option) any later version. | |
145 | +# | |
146 | +# This program is distributed in the hope that it will be useful, | |
147 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
148 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
149 | +# GNU General Public License for more details. | |
150 | +# | |
151 | +# You should have received a copy of the GNU General Public License | |
152 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | |
153 | + | |
154 | +set testfile namespace-no-imports | |
155 | +set srcfile ${testfile}.cc | |
156 | +set binfile ${objdir}/${subdir}/${testfile} | |
157 | +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { | |
158 | + untested "Couldn't compile test program" | |
159 | + return -1 | |
160 | +} | |
161 | + | |
162 | +# Get things started. | |
163 | + | |
164 | +gdb_exit | |
165 | +gdb_start | |
166 | +gdb_reinitialize_dir $srcdir/$subdir | |
167 | +gdb_load ${binfile} | |
168 | + | |
169 | +############################################ | |
170 | +if ![runto_main] then { | |
171 | + perror "couldn't run to breakpoint main" | |
172 | + continue | |
173 | +} | |
174 | + | |
175 | +gdb_test "print A::_a" "= 11" | |
176 | +gdb_test "print A::B::ab" "= 22" | |
177 | +gdb_test "print A::B::C::abc" "= 33" | |
178 | + | |
179 | +gdb_test "print _a" "No symbol .* in current context." | |
180 | +gdb_test "print ab" "No symbol .* in current context." | |
181 | +gdb_test "print abc" "No symbol .* in current context." | |
182 | + | |
183 | +############################################ | |
184 | +gdb_breakpoint A::B::first | |
185 | +gdb_continue_to_breakpoint "A::B::first" | |
186 | + | |
187 | +gdb_test "print A::_a" "= 11" | |
188 | +gdb_test "print A::B::ab" "= 22" | |
189 | +gdb_test "print A::B::C::abc" "= 33" | |
190 | + | |
191 | +gdb_test "print _a" "= 11" | |
192 | +gdb_test "print ab" "= 22" | |
193 | +gdb_test "print C::abc" "= 33" | |
194 | + | |
195 | +gdb_test "print abc" "No symbol .* in current context." | |
196 | + | |
197 | +############################################ | |
198 | +gdb_breakpoint A::B::C::second | |
199 | +gdb_continue_to_breakpoint "A::B::C::second" | |
200 | + | |
201 | +gdb_test "print A::_a" "= 11" | |
202 | +gdb_test "print A::B::ab" "= 22" | |
203 | +gdb_test "print A::B::C::abc" "= 33" | |
204 | + | |
205 | +gdb_test "print _a" "= 11" | |
206 | +gdb_test "print ab" "= 22" | |
207 | +gdb_test "print abc" "= 33" |