1 # Copyright (C) 2016-2019 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Test symbol lookup when there are multiple circular imports.
18 load_lib "d-support.exp"
21 if { [skip_d_tests] } { continue }
23 # This test can only be run on targets which support DWARF-2 and use gas.
24 if {![dwarf2_support]} {
28 standard_testfile circular.c circular-dw.S
30 # Make some DWARF for the test.
31 set asm_file [standard_output_file $srcfile2]
32 Dwarf::assemble $asm_file {
37 declare_labels circular1_label circular2_label circular3_label
38 declare_labels circular4_label circular5_label
40 extern circular1_found_start circular1_found_end
42 circular1_label: module {
46 {import :$circular2_label}
49 {import :$circular3_label}
52 {import :$circular4_label}
55 {import :$circular5_label}
60 {external 1 flag_present}
61 {low_pc circular1_found_start addr}
62 {high_pc circular1_found_end addr}
66 circular2_label: module {
70 {import :$circular1_label}
73 {import :$circular3_label}
76 {import :$circular4_label}
79 {import :$circular5_label}
83 circular3_label: module {
87 {import :$circular1_label}
90 {import :$circular2_label}
93 {import :$circular4_label}
96 {import :$circular5_label}
100 circular4_label: module {
104 {import :$circular1_label}
107 {import :$circular2_label}
110 {import :$circular3_label}
113 {import :$circular5_label}
117 circular5_label: module {
121 {import :$circular1_label}
124 {import :$circular2_label}
127 {import :$circular3_label}
130 {import :$circular4_label}
137 if { [prepare_for_testing "failed to prepare" ${testfile} \
138 [list $srcfile $asm_file] {nodebug}] } {
142 gdb_test_no_output "set language d"
144 if {![runto "circular1.found"]} {
148 # This last test shouldn't timeout.
149 gdb_test "print notfound" "No symbol \"notfound\" in current context."