OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.cp/] [nsusing.exp] - Blame information for rev 330

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2008, 2010 Free Software Foundation, Inc.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program.  If not, see .
15
 
16
if $tracelevel then {
17
    strace $tracelevel
18
}
19
 
20
 
21
set testfile nsusing
22
set srcfile ${testfile}.cc
23
set binfile ${objdir}/${subdir}/${testfile}
24
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
25
      {debug c++}] != "" } {
26
    untested "Couldn't compile test program"
27
    return -1
28
}
29
 
30
if [get_compiler_info ${binfile}] {
31
    return -1
32
}
33
 
34
 
35
# Get things started.
36
 
37
gdb_exit
38
gdb_start
39
gdb_reinitialize_dir $srcdir/$subdir
40
gdb_load ${binfile}
41
 
42
############################################
43
# test printing of namespace imported within
44
# the function.
45
 
46
if ![runto_main] then {
47
    perror "couldn't run to breakpoint main"
48
    continue
49
}
50
 
51
gdb_test "print _a" "= 1"
52
 
53
# Test that names are not printed when they
54
# are not imported
55
 
56
gdb_breakpoint marker3
57
gdb_continue_to_breakpoint "marker3"
58
 
59
#send_gdb "break marker3\n"
60
#send_gdb "continue\n"
61
 
62
gdb_test "print _a" "No symbol \"_a\" in current context." \
63
    "Print _a without import"
64
 
65
gdb_exit
66
gdb_start
67
gdb_reinitialize_dir $srcdir/$subdir
68
gdb_load ${binfile}
69
 
70
 
71
############################################
72
# test printing of namespace imported into
73
# a scope containing the pc.
74
 
75
if ![runto_main] then {
76
    perror "couldn't run to breakpoint main"
77
    continue
78
}
79
 
80
gdb_breakpoint [gdb_get_line_number "marker1 stop"]
81
gdb_continue_to_breakpoint "marker1 stop"
82
 
83
gdb_test "print _a" "= 1" "print _a in a nested scope"
84
 
85
 
86
gdb_exit
87
gdb_start
88
gdb_reinitialize_dir $srcdir/$subdir
89
gdb_load ${binfile}
90
 
91
############################################
92
# test printing of namespace imported into
93
# file scope.
94
 
95
 
96
if ![runto marker5] then {
97
    perror "couldn't run to breakpoint marker5"
98
    continue
99
}
100
 
101
gdb_test "print cc" "= 3"
102
 
103
gdb_exit
104
gdb_start
105
gdb_reinitialize_dir $srcdir/$subdir
106
gdb_load ${binfile}
107
 
108
 
109
############################################
110
# Test printing of namespace aliases
111
 
112
if ![runto marker2] then {
113
    perror "couldn't run to breakpoint marker2"
114
    continue
115
}
116
 
117
gdb_test "print B::_a" "= 1"
118
 
119
gdb_test "print _a" "No symbol \"_a\" in current context." \
120
    "print _a in namespace alias scope"
121
 
122
gdb_test "print x" "No symbol \"x\" in current context." \
123
    "print x in namespace alias scope"
124
 
125
gdb_exit
126
gdb_start
127
gdb_reinitialize_dir $srcdir/$subdir
128
gdb_load ${binfile}
129
 
130
 
131
############################################
132
# Test that names are not printed when they
133
# are not imported
134
 
135
if {![runto marker3]} {
136
    perror "couldn't run to breakpoint marker3"
137
}
138
 
139
# gcc-4-3 puts import statements for aliases in
140
# the global scope instead of the corresponding
141
# function scope. These wrong import statements throw
142
# this test off. This is fixed in gcc-4-4.
143
if [test_compiler_info gcc-4-3-*] then { setup_xfail *-*-* }
144
 
145
gdb_test "print _a" "No symbol \"_a\" in current context." \
146
    "Print _a without import"
147
 
148
############################################
149
# Test printing of individually imported elements
150
 
151
if ![runto marker4] then {
152
    perror "couldn't run to breakpoint marker4"
153
    continue
154
}
155
 
156
gdb_test "print dx" "= 4"
157
 
158
############################################
159
# Test printing of namespace aliases
160
 
161
if ![runto marker5] then {
162
    perror "couldn't run to marker5"
163
    continue
164
}
165
 
166
gdb_test "print efx" "= 5"
167
 
168
############################################
169
# Test printing of variables imported from
170
# nested namespaces
171
 
172
if ![runto I::marker7] then {
173
    perror "couldn't run to breakpoint I::marker7"
174
    continue
175
}
176
 
177
gdb_test "print ghx" "= 6"
178
 
179
############################################
180
# Test that variables are not printed in a namespace
181
# that is sibling to the namespace containing an import
182
 
183
if ![runto L::marker8] then {
184
    perror "couldn't run to breakpoint L::marker8"
185
    continue
186
}
187
 
188
gdb_test "print jx" "= 44"
189
 
190
gdb_breakpoint "K::marker9"
191
gdb_continue_to_breakpoint "K::marker9"
192
 
193
gdb_test "print jx" "No symbol \"jx\" in current context."
194
 
195
############################################
196
# Test that variables are only printed after the line
197
# containing the import
198
 
199
if ![runto_main] then {
200
    perror "couldn't run to breakpoint main"
201
    continue
202
}
203
 
204
gdb_breakpoint [gdb_get_line_number "marker10 stop"]
205
gdb_continue_to_breakpoint "marker10 stop"
206
 
207
if { [test_compiler_info {gcc-[0-3]-*}] ||
208
     [test_compiler_info {gcc-4-[0-3]-*}]} {
209
    setup_xfail *-*-*
210
}
211
 
212
# Assert that M::x is printed and not N::x
213
gdb_test "print x" "= 911" "print x (from M::x)"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.