Copyright year update in most files of the GDB Project.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / anon-ns.exp
1 # Copyright 2011-2012 Free Software Foundation, Inc.
2 #
3 # Contributed by Red Hat, originally written by Keith Seitz.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 # This file is part of the gdb testsuite.
19
20 if {[skip_cplus_tests]} { continue }
21
22 # Tests for c++/12750/12704
23 set testfile "anon-ns"
24 set srcfile $testfile.cc
25
26 if {[prepare_for_testing $testfile $testfile $srcfile {c++ debug}]} {
27 return -1
28 }
29
30 if {![runto_main]} {
31 perror "couldn't run to breakpoint"
32 continue
33 }
34
35 set ans {(anonymous namespace)}
36 set types {"void" "int" "char *"}
37 set methods {}
38 foreach t $types {
39 lappend methods "${ans}::doit1($t)"
40 lappend methods "${ans}::one::one($t)"
41 lappend methods "${ans}::A::doit2($t)"
42 lappend methods "${ans}::A::two::two($t)"
43 lappend methods "${ans}::A::${ans}::${ans}::doit3($t)"
44 lappend methods "${ans}::A::${ans}::${ans}::three::three($t)"
45 }
46
47 lappend methods "${ans}::one::doit(void)"
48 lappend methods "${ans}::A::two::doit(void)"
49 lappend methods "${ans}::A::${ans}::${ans}::three::doit(void)"
50
51 gdb_test_no_output "set listsize 1" ""
52
53 foreach test $methods {
54 # The result we expect is the source code name of the symbol,
55 # i.e., without "(anonymous namespace)".
56 regsub -all [string_to_regexp "${ans}::"] $test "" expected
57 set result ".*// [string_to_regexp $expected]"
58
59 gdb_test "list $test" $result
60 gdb_test "list '$test'" $result
61 if {[gdb_breakpoint $test]} {
62 pass "break $test"
63 }
64 if {[gdb_breakpoint '$test']} {
65 pass "break '$test'"
66 }
67 }
68
69 gdb_exit
70 return 0
This page took 0.032028 seconds and 5 git commands to generate.