[binutils-gdb] [gdb/testsuite, Tcl 9.0] Fix error: invalid character in array index
Tom de Vries
vries@sourceware.org
Fri Mar 20 09:14:46 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=30e4e0e2075f701006c142b8d8e7d0cfa9dd5511
commit 30e4e0e2075f701006c142b8d8e7d0cfa9dd5511
Author: Tom de Vries <tdevries@suse.de>
Date: Fri Mar 20 10:13:27 2026 +0100
[gdb/testsuite, Tcl 9.0] Fix error: invalid character in array index
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
Diff:
---
gdb/testsuite/gdb.cp/ovldbreak.exp | 8 ++++----
gdb/testsuite/lib/cp-support.exp | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp
index 2b647170415..a4e853e2986 100644
--- a/gdb/testsuite/gdb.cp/ovldbreak.exp
+++ b/gdb/testsuite/gdb.cp/ovldbreak.exp
@@ -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
diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp
index cf26406260d..0bc71cd5822 100644
--- a/gdb/testsuite/lib/cp-support.exp
+++ b/gdb/testsuite/lib/cp-support.exp
@@ -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.
More information about the Gdb-cvs
mailing list