Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / dw2-out-of-range-end-of-seq.exp
CommitLineData
88b9d363 1# Copyright 2021-2022 Free Software Foundation, Inc.
e4ad960a
TV
2
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.
7#
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.
12#
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/>.
15
16# Check that an out-of-range DW_LNE_end_sequence is removed from the
17# line table.
18
19load_lib dwarf.exp
20
21# This test can only be run on targets which support DWARF-2 and use gas.
22if {![dwarf2_support]} {
23 verbose "Skipping $gdb_test_file_name."
24 return 0
25}
26
27# The .c files use __attribute__.
28if [get_compiler_info] {
29 return -1
30}
31if !$gcc_compiled {
32 verbose "Skipping $gdb_test_file_name."
33 return 0
34}
35
36standard_testfile main.c -dw.S
37
38set asm_file [standard_output_file $srcfile2]
39Dwarf::assemble $asm_file {
40 declare_labels Llines
41 global srcdir subdir srcfile
42
43 cu {} {
44 compile_unit {
45 {language @DW_LANG_C}
46 {name $srcfile}
47 {stmt_list $Llines DW_FORM_sec_offset}
48 } {
49 subprogram {
50 {external 1 flag}
51 {MACRO_AT_func {main}}
52 }
53 }
54 }
55
56 lines {version 2} Llines {
57 include_dir "${srcdir}/${subdir}"
58 file_name "$srcfile" 1
59
60 program {
61 {DW_LNE_set_address main_label}
62 {line 1}
63 {DW_LNS_copy}
64
65 {DW_LNS_advance_pc 1}
66 {DW_LNE_end_sequence}
67
68 {DW_LNE_set_address 0}
69 {line 2}
70 {DW_LNS_copy}
71
72 {DW_LNS_advance_pc 1}
73 {DW_LNE_end_sequence}
74 }
75 }
76}
77
78if { [prepare_for_testing "failed to prepare" ${testfile} \
79 [list $srcfile $asm_file] {nodebug}] } {
80 return -1
81}
82
83if ![runto_main] {
84 return -1
85}
86
22efa3d3
TV
87set test "END with address 1 eliminated"
88gdb_test_multiple "maint info line-table $srcfile$" $test {
89 -re -wrap "END *0x0*1 *Y \r\n.*" {
e4ad960a
TV
90 fail $gdb_test_name
91 }
22efa3d3 92 -re -wrap "END *$hex *Y " {
e4ad960a
TV
93 pass $gdb_test_name
94 }
95}
This page took 0.10278 seconds and 4 git commands to generate.