A few test-cases wrap code in namespaces.
Since Tcl 9.0, globals are no longer directly available inside namespaces.
Fix this by redeclaring using upvar.
Also, referring to variables in namespaces needs to be done using fully
qualified names. Fix this by adding a :: prefix.
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33948
# tclint-disable-next-line command-args
set list_form [namespace eval ton::2list $last_ton]
set ref [namespace eval ton::2list {
- get $list_form body breakpoints 0 instructionReference
+ get $::list_form body breakpoints 0 instructionReference
}]
gdb_assert {[regexp "^$hex\$" $ref]} \
"instructionReference is a hex string"
}
pointer_label: pointer_type {
- DW_AT_byte_size $Dwarf::_cu_addr_size sdata
+ DW_AT_byte_size $::Dwarf::_cu_addr_size sdata
DW_AT_type :$struct_label
}
# Wrap this whole test in a namespace to avoid contaminating other tests.
namespace eval $testfile {
+ upvar #0 ::srcfile srcfile
+
# Test the given (explicit) LINESPEC which should cause gdb to break
# at LOCATION.
proc test_breakpoint {linespec location} {
# Wrap the entire test in a namespace to avoid contaminating other tests.
namespace eval $testfile {
+ upvar #0 ::srcfile srcfile
+ upvar #0 ::gdb_prompt gdb_prompt
+ upvar #0 ::exefile exefile
# Test the given (explicit) LINESPEC which should cause gdb to break
# at LOCATION.
}
with_test_prefix "complete unique file name" {
- foreach qc $completion::maybe_quoted_list {
+ foreach qc $::completion::maybe_quoted_list {
set cmd "break -source ${qc}3explicit.c${qc}"
test_gdb_complete_unique \
"break -source ${qc}3ex" \
}
with_test_prefix "complete unique label name" {
- foreach qc $completion::maybe_quoted_list {
+ foreach qc $::completion::maybe_quoted_list {
test_gdb_complete_unique \
"break -function myfunction -label ${qc}to" \
"break -function myfunction -label ${qc}top${qc}"
# Wrap the entire test in a namespace to avoid contaminating other tests.
namespace eval $testfile {
+ upvar #0 ::gdb_prompt gdb_prompt
+ upvar #0 ::decimal decimal
# Start inferior NUM and record its PID in the TESTPID array.
Term::_move_cursor 0 0
Term::_insert "${::border}(gdb) "
- set pos $Term::_cur_col
+ set pos $::Term::_cur_col
Term::_insert "foo"
Term::_move_cursor 0 1
Term::_insert "${::border}(gdb) "
- set pos $Term::_cur_col
+ set pos $::Term::_cur_col
Term::_move_cursor 19 1
Term::_insert "$::border"