1 # Copyright 2020-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 that "break /absolute/file:line" works ok with imported CUs.
20 # This test can only be run on targets which support DWARF-2 and use gas.
21 if {![dwarf2_support]} {
25 # The .c files use __attribute__.
26 if [get_compiler_info] {
33 standard_testfile imported-unit-bp-alt.c .S imported-unit-bp-main.c
35 set build_options {nodebug optimize=-O1}
37 set asm_file [standard_output_file $srcfile2]
38 Dwarf::assemble $asm_file {
39 global srcdir subdir srcfile srcfile
41 declare_labels lines_label callee_subprog_label cu_label
43 get_func_info func "$build_options additional_flags=-DWITHMAIN"
57 cu_label: compile_unit {
63 {stmt_list ${lines_label} DW_FORM_sec_offset}
65 callee_subprog_label: subprogram {
73 {low_pc $func_start addr}
74 {high_pc "$func_start + $func_len" addr}
80 lines {version 2 default_is_stmt 1} lines_label {
82 file_name "$srcfile" 1
85 {DW_LNE_set_address line_label_1}
86 {DW_LNS_advance_line 15}
89 {DW_LNE_set_address line_label_2}
90 {DW_LNS_advance_line 1}
93 {DW_LNE_set_address line_label_3}
94 {DW_LNS_advance_line 4}
97 {DW_LNE_set_address line_label_4}
98 {DW_LNS_advance_line 1}
101 {DW_LNS_advance_line -4}
105 {DW_LNE_set_address line_label_5}
106 {DW_LNS_advance_line 1}
109 {DW_LNE_set_address line_label_6}
110 {DW_LNS_advance_line 1}
114 {DW_LNE_set_address line_label_7}
115 {DW_LNE_end_sequence}
120 if { [prepare_for_testing "failed to prepare" ${testfile} \
121 [list $srcfile $asm_file $srcfile3] $build_options] } {
125 gdb_reinitialize_dir /tmp
127 # Using an absolute path is important to see the bug.
128 gdb_test "break /tmp/${srcfile}:19" "Breakpoint .* file $srcfile, line .*"