[binutils-gdb] [gdb/testsuite] Add aranges in gdb.dwarf2/dwzbuildid.exp

Tom de Vries vries@sourceware.org
Fri Sep 8 10:27:16 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7f49a8c074271efcf7930f4a476927155170a3d1

commit 7f49a8c074271efcf7930f4a476927155170a3d1
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Sep 8 12:27:02 2023 +0200

    [gdb/testsuite] Add aranges in gdb.dwarf2/dwzbuildid.exp
    
    While investigating the execs of gdb.dwarf2/dwzbuildid.exp using readelf I ran
    into a warning:
    ...
    $ readelf -w dwzbuildid-ok > READELF
    readelf: Warning: .debug_info offset of 0x2e in .debug_aranges section does not
    point to a CU header.
    ...
    
    AFAICT, the warning is incorrect, I've filed PR binutils/30835 about that.
    
    While looking at the .debug_aranges section, I noticed that the entries for
    the CUs generated by the dwarf assembler are missing.
    
    Fix this by adding the missing .debug_aranges entries.
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/gdb.dwarf2/dwzbuildid.exp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
index 1aad712e32c..721aef8d344 100644
--- a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
@@ -46,10 +46,13 @@ proc write_just_debugaltlink {filename dwzname buildid} {
 
 	# Only the DWARF reader checks .gnu_debugaltlink, so make sure
 	# there is a bit of DWARF in here.
-	cu {} {
+	cu { label cu_start } {
 	    compile_unit {{language @DW_LANG_C}} {
 	    }
 	}
+	aranges {} cu_start {
+	    arange {} 0 0
+	}
     }
 }
 
@@ -65,7 +68,7 @@ proc write_dwarf_file {filename buildid {value 99}} {
 
 	build_id $buildid
 
-	cu {} {
+	cu { label cu_start } {
 	    compile_unit {{language @DW_LANG_C}} {
 		int_label2: base_type {
 		    {name int}
@@ -80,6 +83,10 @@ proc write_dwarf_file {filename buildid {value 99}} {
 		}
 	    }
 	}
+
+	aranges {} cu_start {
+	    arange {} 0 0
+	}
     }
 }


More information about the Gdb-cvs mailing list