1 # Copyright 2023-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 line number information in various configurations.
20 # This test can only be run on targets which support DWARF-2 and use gas.
21 require dwarf2_support
23 standard_testfile dw2-lines.c -dw2.S
26 set func_info_vars [get_func_info bar]
32 set line [gdb_get_line_number "$l:" $srcfile]
33 return [expr $line + 1]
36 set asm_file [standard_output_file $srcfile2]
37 Dwarf::assemble $asm_file {
39 global srcdir subdir srcfile objdir
41 foreach var $func_info_vars {
47 {language @DW_LANG_Mips_Assembler}
50 {stmt_list $Llines DW_FORM_sec_offset}
51 {producer "GNU AS 2.35.2"}
56 {low_pc $bar_start addr}
57 {high_pc "$bar_start + $bar_len" addr}
62 lines [list version 5] Llines {
63 set diridx1 [include_dir "${srcdir}/${subdir}"]
64 set diridx2 [include_dir "${srcdir}/${subdir}"]
65 file_name "$srcfile" $diridx1
66 file_name "$srcfile" $diridx2
69 DW_LNE_set_address bar_label
70 line [line_for bar_label]
73 DW_LNE_set_address bar_label_2
79 if { [prepare_for_testing "failed to prepare" ${testfile} \
80 [list $srcfile $asm_file] {nodebug}] } {
84 gdb_test_no_output "set debug symtab-create 1"
85 gdb_test_multiple "ptype bar" "" {
86 -re -wrap "name_for_id = $objdir/$srcfile\r\n.*" {