]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.dwarf2/dw2-prologue-end.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / dw2-prologue-end.exp
CommitLineData
1d506c26 1# Copyright 2022-2024 Free Software Foundation, Inc.
cc96ae7f
LS
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 GDB can honor the prologue_end flag the compiler can place
17# in the line-table data.
18
19load_lib dwarf.exp
20
21# This test can only be run on targets which support DWARF-2 and use gas.
ce8d533e 22require dwarf2_support
cc96ae7f
LS
23
24standard_testfile .c .S
25
26set asm_file [standard_output_file $srcfile2]
27Dwarf::assemble $asm_file {
28 global srcdir subdir srcfile srcfile2
29 declare_labels lines_label
30
31 get_func_info main
32
33 cu {} {
34 compile_unit {
35 {language @DW_LANG_C}
36 {name dw2-prologue-end.c}
37 {stmt_list ${lines_label} DW_FORM_sec_offset}
38 } {
39 subprogram {
40 {external 1 flag}
41 {name main}
42 {low_pc $main_start addr}
43 {high_pc "$main_start + $main_len" addr}
44 }
45 }
46 }
47
48 lines {version 5} lines_label {
9a0de6ab
SM
49 set diridx [include_dir "${srcdir}/${subdir}"]
50 file_name "$srcfile" $diridx
cc96ae7f
LS
51
52 program {
9a0de6ab 53 DW_LNS_set_file $diridx
d4c4a229
SM
54 DW_LNE_set_address $main_start
55 line [gdb_get_line_number "main prologue"]
56 DW_LNS_copy
cc96ae7f 57
d4c4a229
SM
58 DW_LNE_set_address main_label
59 line [gdb_get_line_number "main assign m"]
60 DW_LNS_copy
cc96ae7f 61
d4c4a229
SM
62 DW_LNE_set_address main_assign_n
63 line [gdb_get_line_number "main assign n"]
64 DW_LNS_copy
cc96ae7f 65
d4c4a229
SM
66 DW_LNE_set_address main_end_prologue
67 line [gdb_get_line_number "main assign o"]
68 DW_LNS_set_prologue_end
69 DW_LNS_copy
cc96ae7f 70
d4c4a229
SM
71 DW_LNE_set_address main_end
72 line [gdb_get_line_number "main end"]
73 DW_LNS_copy
cc96ae7f 74
d4c4a229 75 DW_LNE_end_sequence
cc96ae7f
LS
76 }
77 }
78}
79
80if { [prepare_for_testing "failed to prepare" ${testfile} \
81 [list $srcfile $asm_file] {nodebug}] } {
82 return -1
83}
84
85if ![runto_main] {
86 return -1
87}
88
89set prologue_end_line [gdb_get_line_number "main assign o"]
90gdb_test "frame" ".*main \\\(\\\) at \[^\r\n\]*:$prologue_end_line\r\n.*"
6109f7a3
LS
91
92with_test_prefix "ignore-prologue-end" {
93 clean_restart $binfile
94 gdb_test_no_output "maintenance set ignore-prologue-end-flag on"
95
96 if ![runto_main] {
97 return -1
98 }
99
100 # If we ignore the prologue-end flag, we should stop at the first statement
101 # of main which assigns m.
102 set prologue_end_line [gdb_get_line_number "main assign m"]
103 gdb_test "frame" ".*main \\\(\\\) at \[^\r\n\]*:$prologue_end_line\r\n.*"
104}