* gdb.cp/cpcompletion.exp (test_class_complete): New procedure.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / namespace-using.exp
CommitLineData
27aa8d6a
SW
1# Copyright 2008 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 <http://www.gnu.org/licenses/>.
15
16if $tracelevel then {
17 strace $tracelevel
18}
19
20set prms_id 0
21set bug_id 0
22
23set testfile namespace-using
24set srcfile ${testfile}.cc
25set binfile ${objdir}/${subdir}/${testfile}
26if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
27 untested "Couldn't compile test program"
28 return -1
29}
30
31# Get things started.
32
33gdb_exit
34gdb_start
35gdb_reinitialize_dir $srcdir/$subdir
36gdb_load ${binfile}
37
38############################################
39# test printing of namespace imported within
40# the function.
41
42if ![runto_main] then {
43 perror "couldn't run to breakpoint main"
44 continue
45}
46
47gdb_test "print _a" "= 1"
48
49############################################
50# test printing of namespace imported into
51# a scope containing the pc.
52
53gdb_breakpoint [gdb_get_line_number "marker1 stop"]
54gdb_continue_to_breakpoint "marker1 stop"
55
56gdb_test "print _a" "= 1" "print _a in a nested scope"
57
58############################################
59# Test printing of namespace aliases
60
61setup_kfail "gdb/7935" "*-*-*"
62if ![runto marker2] then {
63 perror "couldn't run to breakpoint marker2"
64 continue
65}
66
67gdb_test "print B::a" "= 1"
68
69############################################
70# Test that names are not printed when they
71# are not imported
72
73gdb_breakpoint "marker3"
74gdb_continue_to_breakpoint "marker3"
75
76gdb_test "print _a" "No symbol \"_a\" in current context." "Print a without import"
77
78############################################
79# Test printing of individually imported elements
80
81setup_kfail "gdb/7936" "*-*-*"
82if ![runto marker4] then {
83 perror "couldn't run to breakpoint marker4"
84 continue
85}
86
87gdb_test "print x" "= 2"
This page took 0.045856 seconds and 4 git commands to generate.