2010-01-14 Sami Wagiaalla <swagiaal@redhat.com>
[external/binutils.git] / gdb / testsuite / gdb.cp / nsrecurs.exp
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
16 # Test recursive namespace lookup
17
18 if $tracelevel then {
19     strace $tracelevel
20 }
21
22 set prms_id 0
23 set bug_id 0
24
25 set testfile nsrecurs
26 set srcfile ${testfile}.cc
27 set binfile ${objdir}/${subdir}/${testfile}
28 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
29     untested "Couldn't compile test program"
30     return -1
31 }
32
33 if [get_compiler_info ${binfile}] {
34     return -1
35 }
36
37
38 # Get things started.
39
40 gdb_exit
41 gdb_start
42 gdb_reinitialize_dir $srcdir/$subdir
43 gdb_load ${binfile}
44
45 if ![runto_main] then {
46     perror "couldn't run to breakpoint main"
47     continue
48 }
49
50 ############################################
51 # test printing from namespace imported into
52 # imported namespace
53
54 gdb_test "print ax" "= 9"
55
56 ############################################
57 # test that gdb can print without falling
58 # into search loop
59
60 gdb_test "print dx" "= 99"
61
62 ############################################
63 # test printing from namespace imported into
64 # imported namespace where imports are implicit
65 # anonymous namespace imports.
66
67 gdb_test "print xx" "= 999"