[gdb/testsuite] Add .debug_aranges in more test-cases

A couple of test-cases fail when run with target board cc-with-debug-names due
to missing .debug_aranges entries for the CUs added by the dwarf assembler.

Add a .debug_aranges entry for those CUs.

Tested on x86_64-linux.
This commit is contained in:
Tom de Vries 2021-08-27 16:38:53 +02:00
parent 9f63756509
commit 1d4a20b576
3 changed files with 22 additions and 3 deletions

View file

@ -52,7 +52,7 @@ Dwarf::assemble $asm_file {
# this information being correct (w.r.t. funtion / argument types)
# just so long as the compilation using makes use of the
# .debug_ranges data then the test achieves its objective.
cu {} {
cu { label cu_label } {
compile_unit {
{language @DW_LANG_C}
{name dw-ranges-base.c}
@ -123,6 +123,12 @@ Dwarf::assemble $asm_file {
range 0 [lindex $frame3_func 1]
}
}
aranges {} cu_label {
arange [lindex $main_func 0] [lindex $main_func 1]
arange [lindex $frame2_func 0] [lindex $frame2_func 1]
arange [lindex $frame3_func 0] [lindex $frame3_func 1]
}
}
if { [prepare_for_testing "failed to prepare" ${testfile} \

View file

@ -43,7 +43,7 @@ Dwarf::assemble $dwarf_asm {
# See the comment in the .S file for the equivalent C program this is meant
# to represent.
cu { addr_size 4 } {
cu { label cu_label addr_size 4 } {
DW_TAG_compile_unit {
{DW_AT_name $srcfile}
{DW_AT_stmt_list $stmt_list DW_FORM_sec_offset}
@ -93,6 +93,10 @@ Dwarf::assemble $dwarf_asm {
include_dir "/some/directory"
file_name "/some/directory/file.c" 0
}
aranges {} cu_label {
arange __cu_low_pc __cu_high_pc
}
}
if { [build_executable ${testfile}.exp ${testfile} "$srcfile $dwarf_asm" \

View file

@ -28,9 +28,14 @@ if {![dwarf2_support]} {
standard_testfile main.c .S
lassign [function_range main ${srcdir}/${subdir}/${srcfile}] \
main_start main_length
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
cu {} {
global main_start main_length
cu { label cu_start } {
DW_TAG_compile_unit {
{DW_AT_language @DW_LANG_C_plus_plus}
} {
@ -62,6 +67,10 @@ Dwarf::assemble $asm_file {
}
}
}
aranges {} cu_start {
arange "$main_start" "$main_length"
}
}
if { [prepare_for_testing "failed to prepare" ${testfile} \