1 # Copyright (C) 2016-2021 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 circular1_label: module {
44 {import :$circular2_label}
47 {import :$circular3_label}
50 {import :$circular4_label}
53 {import :$circular5_label}
57 {external 1 flag_present}
58 {MACRO_AT_func {found}}
62 circular2_label: module {
66 {import :$circular1_label}
69 {import :$circular3_label}
72 {import :$circular4_label}
75 {import :$circular5_label}
79 circular3_label: module {
83 {import :$circular1_label}
86 {import :$circular2_label}
89 {import :$circular4_label}
92 {import :$circular5_label}
96 circular4_label: module {
100 {import :$circular1_label}
103 {import :$circular2_label}
106 {import :$circular3_label}
109 {import :$circular5_label}
113 circular5_label: module {
117 {import :$circular1_label}
120 {import :$circular2_label}
123 {import :$circular3_label}
126 {import :$circular4_label}
133 if { [prepare_for_testing "failed to prepare" ${testfile} \
134 [list $srcfile $asm_file] {nodebug}] } {
138 gdb_test_no_output "set language d"
140 if {![runto "circular1.found"]} {
144 # This last test shouldn't timeout.
145 gdb_test "print notfound" "No symbol \"notfound\" in current context."