]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite, Tcl 9.0] Fix error: invalid character in array index
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.cp/inherit.exp and Tcl 9.0, I run into:
...
ERROR: tcl error sourcing gdb.cp/inherit.exp.
ERROR: tcl error code NONE
ERROR: invalid character in array index
    while executing
"set in_class_table $cp_class_table_history("
    invoked from within
"if {$in_class_table == "ibid"} {
if {![info exists cp_class_table_history("$in_key,$in_tag")]} {
...

Fix this by dropping the double quotes in
'cp_class_table_history("$in_key,$in_tag")'.

Likewise in gdb.cp/ovldbreak.exp.

Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33948

gdb/testsuite/gdb.cp/ovldbreak.exp
gdb/testsuite/lib/cp-support.exp

index 2b647170415904d228e9e5ef8ebcc22b348e7a5d..a4e853e2986e30a9b05fc24c5b1bf4740ed1c637 100644 (file)
@@ -196,7 +196,7 @@ foreach type $all_types {
 
                # Create an inverse mapping of the actual type to
                # the synthetic type.
-               set type_map("$types($type)") $type
+               set type_map($types($type)) $type
                pass "detect $type"
            }
     }
@@ -237,7 +237,7 @@ set method "foo::overload1arg"
 for {set idx 0} {$idx < [llength $overloads]} {incr idx} {
     set type [lindex $overloads $idx]
     set_bp_overloaded $method $menu_overload1arg \
-       [expr {$idx + 2}] [incr bpnum] $line($type_map("$type"))
+       [expr {$idx + 2}] [incr bpnum] $line($type_map($type))
 }
 
 # Verify the breakpoints.
@@ -246,7 +246,7 @@ append bptable "${::decimal}\[\t \]+breakpoint\[\t \]+keep\[\t \]y\[\t \]+$hex\[
 append bptable "\[\t \]+breakpoint already hit 1 time"
 foreach ovld $overloads {
     append bptable [format "\r\n${::decimal}\[\t \]+breakpoint\[\t \]+keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d" $ovld \
-                       $line($type_map("$ovld"))]
+                       $line($type_map($ovld))]
 }
 gdb_test "info break" $bptable "breakpoint info, after setting one-by-one"
 
@@ -298,7 +298,7 @@ with_test_prefix "multiple breakpoints" {
     set expected_lines {}
     for {set i 0} {$i < 2} {incr i} {
        set type [lindex $overloads $i]
-       lappend expected_lines $line($type_map("$type"))
+       lappend expected_lines $line($type_map($type))
     }
     set_bp_overloaded $method $menu_overload1arg \
        "2-3" [incr bpnum] $expected_lines
index cf26406260d4e818a35bf9160e5d62deb174c2d1..0bc71cd5822f034cc1e8488892b289f181cbd1ce 100644 (file)
@@ -261,13 +261,13 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table
 
     global cp_class_table_history
     if {$in_class_table == "ibid"} {
-       if {![info exists cp_class_table_history("$in_key,$in_tag")]} {
+       if {![info exists cp_class_table_history($in_key,$in_tag)]} {
            fail "$in_testname // bad ibid"
            return false
        }
-       set in_class_table $cp_class_table_history("$in_key,$in_tag")
+       set in_class_table $cp_class_table_history($in_key,$in_tag)
     } else {
-       set cp_class_table_history("$in_key,$in_tag") $in_class_table
+       set cp_class_table_history($in_key,$in_tag) $in_class_table
     }
 
     # Split the class table into separate tables.