After running test-case gdb.dwarf2/gdb-index-nodebug.exp I have:
...
$ ls build/gdb/testsuite
cache config.status gdb.log lib outputs site.exp
config.log gdb-index-nodebug.gdb-index gdb.sum Makefile site.bak temp
...
The file gdb-index-nodebug.gdb-index doesn't belong there.
It happens to be there because we do:
...
set index_file ${testfile}.gdb-index
set cmd "save gdb-index [file dirname ${index_file}]"
...
which results in:
...
(gdb) save gdb-index .
...
The intention was possibly to use $binfile instead of $testfile, but using
that wouldn't work for remote host.
Fix this by using host_standard_output_file.
Tested on x86_64-linux.
set no_debug_re [join $no_debug_re]
set readnow_p [readnow]
-set index_file ${testfile}.gdb-index
+set index_dir [host_standard_output_file ""]
# The bug was that gdb would crash here.
-set cmd "save gdb-index [file dirname ${index_file}]"
+set cmd "save gdb-index $index_dir"
gdb_test_multiple $cmd "try to save gdb index" {
-re -wrap $have_index_re {
if { $have_index != "" || $readnow_p } {