]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright 2021-2023 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 | ||
19 | load_lib dwarf.exp | |
20 | ||
21 | # This test can only be run on targets which support DWARF-2 and use gas. | |
22 | if {![dwarf2_support]} { | |
23 | verbose "Skipping $gdb_test_file_name." | |
24 | return 0 | |
25 | } | |
26 | ||
27 | # The .c files use __attribute__. | |
ef7a6b97 | 28 | if ![is_c_compiler_gcc] { |
e4ad960a TV |
29 | verbose "Skipping $gdb_test_file_name." |
30 | return 0 | |
31 | } | |
32 | ||
33 | standard_testfile main.c -dw.S | |
34 | ||
de51bd91 TV |
35 | set func_info_vars [get_func_info main] |
36 | ||
e4ad960a TV |
37 | set asm_file [standard_output_file $srcfile2] |
38 | Dwarf::assemble $asm_file { | |
39 | declare_labels Llines | |
40 | global srcdir subdir srcfile | |
de51bd91 TV |
41 | global func_info_vars |
42 | foreach var $func_info_vars { | |
43 | global $var | |
44 | } | |
e4ad960a TV |
45 | |
46 | cu {} { | |
47 | compile_unit { | |
48 | {language @DW_LANG_C} | |
49 | {name $srcfile} | |
50 | {stmt_list $Llines DW_FORM_sec_offset} | |
51 | } { | |
52 | subprogram { | |
53 | {external 1 flag} | |
de51bd91 TV |
54 | {name main} |
55 | {low_pc $main_start} | |
56 | {high_pc $main_end addr} | |
e4ad960a TV |
57 | } |
58 | } | |
59 | } | |
60 | ||
61 | lines {version 2} Llines { | |
62 | include_dir "${srcdir}/${subdir}" | |
63 | file_name "$srcfile" 1 | |
64 | ||
65 | program { | |
de51bd91 | 66 | DW_LNE_set_address $main_start |
d4c4a229 SM |
67 | line 1 |
68 | DW_LNS_copy | |
e4ad960a | 69 | |
de51bd91 | 70 | DW_LNE_set_address $main_end |
d4c4a229 | 71 | DW_LNE_end_sequence |
e4ad960a | 72 | |
d4c4a229 SM |
73 | DW_LNE_set_address 0 |
74 | line 2 | |
75 | DW_LNS_copy | |
e4ad960a | 76 | |
d4c4a229 SM |
77 | DW_LNS_advance_pc 1 |
78 | DW_LNE_end_sequence | |
e4ad960a TV |
79 | } |
80 | } | |
81 | } | |
82 | ||
83 | if { [prepare_for_testing "failed to prepare" ${testfile} \ | |
84 | [list $srcfile $asm_file] {nodebug}] } { | |
85 | return -1 | |
86 | } | |
87 | ||
88 | if ![runto_main] { | |
89 | return -1 | |
90 | } | |
91 | ||
22efa3d3 TV |
92 | set test "END with address 1 eliminated" |
93 | gdb_test_multiple "maint info line-table $srcfile$" $test { | |
cc96ae7f | 94 | -re -wrap "END *0x0*1 *Y *\r\n.*" { |
e4ad960a TV |
95 | fail $gdb_test_name |
96 | } | |
cc96ae7f | 97 | -re -wrap "END *$hex *Y *" { |
e4ad960a TV |
98 | pass $gdb_test_name |
99 | } | |
100 | } |