]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite, Tcl 9.0] Fix error: no such variable: Dwarf::_line_unit_version
authorTom de Vries <tdevries@suse.de>
Fri, 20 Mar 2026 09:13:27 +0000 (10:13 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 20 Mar 2026 09:13:27 +0000 (10:13 +0100)
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 <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33948

gdb/testsuite/lib/dwarf.exp

index 9fa5c4e297daa785c412ffdaae020afdfafac847..b4a6ecc39ffb689aea3f83c6323adcd6eb34f4ef 100644 (file)
@@ -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