Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright 2011-2015 Free Software Foundation, Inc. |
fa8b9902 KS |
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 | ||
29f0c3b7 | 22 | standard_testfile .cc anon-ns2.cc |
fa8b9902 | 23 | |
29f0c3b7 | 24 | if {[prepare_for_testing $testfile $testfile "$srcfile $srcfile2" {c++ debug}]} { |
fa8b9902 KS |
25 | return -1 |
26 | } | |
27 | ||
28 | if {![runto_main]} { | |
29 | perror "couldn't run to breakpoint" | |
30 | continue | |
31 | } | |
32 | ||
33 | set ans {(anonymous namespace)} | |
34 | set types {"void" "int" "char *"} | |
35 | set methods {} | |
36 | foreach t $types { | |
37 | lappend methods "${ans}::doit1($t)" | |
38 | lappend methods "${ans}::one::one($t)" | |
39 | lappend methods "${ans}::A::doit2($t)" | |
40 | lappend methods "${ans}::A::two::two($t)" | |
41 | lappend methods "${ans}::A::${ans}::${ans}::doit3($t)" | |
42 | lappend methods "${ans}::A::${ans}::${ans}::three::three($t)" | |
43 | } | |
44 | ||
45 | lappend methods "${ans}::one::doit(void)" | |
46 | lappend methods "${ans}::A::two::doit(void)" | |
47 | lappend methods "${ans}::A::${ans}::${ans}::three::doit(void)" | |
48 | ||
49 | gdb_test_no_output "set listsize 1" "" | |
50 | ||
51 | foreach test $methods { | |
52 | # The result we expect is the source code name of the symbol, | |
53 | # i.e., without "(anonymous namespace)". | |
54 | regsub -all [string_to_regexp "${ans}::"] $test "" expected | |
55 | set result ".*// [string_to_regexp $expected]" | |
56 | ||
57 | gdb_test "list $test" $result | |
58 | gdb_test "list '$test'" $result | |
59 | if {[gdb_breakpoint $test]} { | |
60 | pass "break $test" | |
61 | } | |
62 | if {[gdb_breakpoint '$test']} { | |
63 | pass "break '$test'" | |
64 | } | |
65 | } | |
66 | ||
96553a0c DE |
67 | # PR c++/17976 |
68 | gdb_test "ptype '(anonymous namespace)'" \ | |
69 | "type = namespace \\\(anonymous namespace\\\)" | |
70 | ||
fa8b9902 KS |
71 | gdb_exit |
72 | return 0 |