1 # Copyright (C) 2016-2024 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 require allow_d_tests dwarf2_support
23 standard_testfile circular.c circular-dw.S
25 # Make some DWARF for the test.
26 set asm_file [standard_output_file $srcfile2]
27 Dwarf::assemble $asm_file {
32 declare_labels circular1_label circular2_label circular3_label
33 declare_labels circular4_label circular5_label
35 circular1_label: module {
39 {import :$circular2_label}
42 {import :$circular3_label}
45 {import :$circular4_label}
48 {import :$circular5_label}
52 {external 1 flag_present}
53 {MACRO_AT_func {found}}
57 circular2_label: module {
61 {import :$circular1_label}
64 {import :$circular3_label}
67 {import :$circular4_label}
70 {import :$circular5_label}
74 circular3_label: module {
78 {import :$circular1_label}
81 {import :$circular2_label}
84 {import :$circular4_label}
87 {import :$circular5_label}
91 circular4_label: module {
95 {import :$circular1_label}
98 {import :$circular2_label}
101 {import :$circular3_label}
104 {import :$circular5_label}
108 circular5_label: module {
112 {import :$circular1_label}
115 {import :$circular2_label}
118 {import :$circular3_label}
121 {import :$circular4_label}
128 if { [prepare_for_testing "failed to prepare" ${testfile} \
129 [list $srcfile $asm_file] {nodebug}] } {
133 gdb_test_no_output "set language d"
135 if {![runto "circular1.found"]} {
139 # This last test shouldn't timeout.
140 gdb_test "print notfound" "No symbol \"notfound\" in current context."