[binutils-gdb] [gdb/testsuite] Improve dwarf assembly for implicit const in .debug_names

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

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

    [gdb/testsuite] Improve dwarf assembly for implicit const in .debug_names
    
    In the assembly generated for the dwarf assembly for test-case
    gdb.dwarf2/debug-names-tu-dwarf5.exp, there's this bit:
    ...
    .uleb128        0x2003          /* DW_IDX_GNU_language */
    .uleb128        0x21            /* DW_FORM_flag_present */
    .sleb128        0x0002          /* DW_LANG_C */
    ...
    
    As it happens, 0x21 is not DW_FORM_flag_present, but DW_FORM_implicit_const,
    and the following entry is the value of the attribute.
    
    Fix the comment, and make the relation between the two entries more clear by
    printing:
    ...
    .uleb128        0x2003          /* DW_IDX_GNU_language */
    .uleb128        0x21            /* DW_FORM_implicit_const */
    .sleb128        0x0002          /* DW_FORM_implicit_const value: DW_LANG_C */
    ...
    
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/testsuite/lib/dwarf.exp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 5358dc317a1..9575f4b0b1c 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -3636,8 +3636,9 @@ namespace eval Dwarf {
 		    _op .uleb128 $_constants(DW_IDX_GNU_language) \
 			"DW_IDX_GNU_language"
 		    _op .uleb128 $_constants(DW_FORM_implicit_const) \
-			"DW_FORM_flag_present"
-		    _op .sleb128 $_constants($word) $word
+			"DW_FORM_implicit_const"
+		    _op .sleb128 $_constants($word) \
+			"DW_FORM_implicit_const value: $word"
 		} else {
 		    error "unrecognized extra keyword $word"
 		}