[binutils-gdb] [gdb/testsuite] Add missing type_offset in gdb.dwarf/debug-names-tu.exp

Tom de Vries via Gdb-cvs <[email protected]> Sat, 23 May 2026 08:17:23 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ee7bb7c152c3ab1395c6771fb8aa20f431873d48

commit ee7bb7c152c3ab1395c6771fb8aa20f431873d48
Author: Tom de Vries <[email protected]>
Date:   Sat May 23 10:16:57 2026 +0200

    [gdb/testsuite] Add missing type_offset in gdb.dwarf/debug-names-tu.exp
    
    With llvm-dwarfdump we run into this warning:
    ...
    $ llvm-dwarfdump -a -v debug-names-tu > /dev/null
    warning: DWARF type unit at offset 0x00000028 has its relocated type_offset \
      0x00000028 pointing inside the header
    ...
    
    Fix this by adding the missing type_offset.
    
    Likewise in gdb.dwarf2/debug-names-bad-cu-index.exp.
    
    Approved-By: Tom Tromey <[email protected]>
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34157

Diff:
---
 gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp | 6 ++++--
 gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl       | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp b/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
index 10e649f06af..5d31414ba29 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-bad-cu-index.exp
@@ -34,6 +34,8 @@ Dwarf::assemble {
 	global $var
     }
 
+    declare_labels type_offset
+
     cu { label cu_label } {
 	compile_unit {
 	    DW_AT_language @DW_LANG_C
@@ -47,11 +49,11 @@ Dwarf::assemble {
 	}
     }
 
-    tu { label tu_label } 0x8ece66f4224fddb3 "" {
+    tu { label tu_label } 0x8ece66f4224fddb3 type_offset {
 	type_unit {} {
 	    declare_labels int_type
 
-	    structure_type {
+	    type_offset: structure_type {
 		DW_AT_name struct_with_int_member
 		DW_AT_byte_size 4 sdata
 	    } {
diff --git a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
index af3f263a273..bd48df6a894 100644
--- a/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
+++ b/gdb/testsuite/gdb.dwarf2/debug-names-tu.exp.tcl
@@ -39,6 +39,8 @@ Dwarf::assemble {
 	global $var
     }
 
+    declare_labels type_label
+
     cu { label cu_label version $dwarf_version } {
 	compile_unit {
 	    DW_AT_language @DW_LANG_C
@@ -52,13 +54,13 @@ Dwarf::assemble {
 	}
     }
 
-    tu { label tu_label version $dwarf_version } 0x8ece66f4224fddb3 "" {
+    tu { label tu_label version $dwarf_version } 0x8ece66f4224fddb3 type_label {
 	type_unit {
 	    DW_AT_language @DW_LANG_C
 	} {
 	    declare_labels int_type
 
-	    structure_type {
+	    type_label: structure_type {
 		DW_AT_name struct_with_int_member
 		DW_AT_byte_size 4 sdata
 	    } {