[binutils-gdb] [gdb/testsuite, Tcl 9.0] Fix error: no such variable: Dwarf::_line_unit_version

Tom de Vries via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=41c8e13d840130fddf2b3f7694aa050e5e6cea57

commit 41c8e13d840130fddf2b3f7694aa050e5e6cea57
Author: Tom de Vries <[email protected]>
Date:   Fri Mar 20 10:13:27 2026 +0100

    [gdb/testsuite, Tcl 9.0] Fix error: no such variable: Dwarf::_line_unit_version
    
    With test-case gdb.base/until-trailing-insns.exp and Tcl 9.0, I run into:
    ...
    ERROR: tcl error sourcing gdb.base/until-trailing-insns.exp.
    ERROR: tcl error code TCL LOOKUP VARNAME Dwarf::_line_unit_version
    ERROR: can't read "Dwarf::_line_unit_version": no such variable
        while executing
    "if { $Dwarf::_line_unit_version >= 5 } {
                    return [expr {[llength $_line_include_dirs] - 1}]
                } else {
                    return [llength $_line_include_dirs]
               ..."
        (procedure "include_dir" line 5)
    ...
    
    Fix this by dropping the Dwarf prefix.
    
    Approved-By: Tom Tromey <[email protected]>
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33948

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

diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 9fa5c4e297d..b4a6ecc39ff 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2614,7 +2614,8 @@ namespace eval Dwarf {
 	    variable _line_include_dirs
 	    lappend _line_include_dirs $dirname
 
-	    if { $Dwarf::_line_unit_version >= 5 } {
+	    variable _line_unit_version
+	    if { $_line_unit_version >= 5 } {
 		return [expr {[llength $_line_include_dirs] - 1}]
 	    } else {
 		return [llength $_line_include_dirs]
@@ -2629,7 +2630,8 @@ namespace eval Dwarf {
 	    lappend _line_file_names $filename $diridx
 
 	    set nr_filenames [expr {[llength $_line_file_names] / 2}]
-	    if { $Dwarf::_line_unit_version >= 5 } {
+	    variable _line_unit_version
+	    if { $_line_unit_version >= 5 } {
 		return [expr {$nr_filenames - 1}]
 	    } else {
 		return $nr_filenames
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.