2
0
mirror of https://sourceware.org/git/binutils-gdb.git synced 2024-12-21 04:42:53 +08:00
binutils-gdb/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
Tom de Vries 385ab37c5b [gdb/testsuite] Fix stray file in gdb.dwarf2/gdb-index-nodebug.exp
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.
2024-05-01 11:11:24 +02:00

56 lines
1.6 KiB
Plaintext

# Copyright 2021-2024 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
load_lib dwarf.exp
standard_testfile main.c
if {[prepare_for_testing "failed to prepare" "${testfile}" \
[list ${srcfile}] {nodebug}]} {
return -1
}
set have_index [have_index $binfile]
set have_index_re \
[list \
"Error while writing index for \[^\r\n\]*:" \
"Cannot use an index to create the index"]
set have_index_re [join $have_index_re]
set no_debug_re \
[list \
"Error while writing index for \[^\r\n\]*:" \
"No debugging symbols"]
set no_debug_re [join $no_debug_re]
set readnow_p [readnow]
set index_dir [host_standard_output_file ""]
# The bug was that gdb would crash here.
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 } {
unsupported $gdb_test_name
} else {
fail $gdb_test_name
}
}
-re -wrap $no_debug_re {
pass $gdb_test_name
}
-re -wrap "^" {
pass $gdb_test_name
}
}