aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-08-02 15:31:51 +0200
committerTom de Vries <tdevries@suse.de>2021-08-02 15:31:51 +0200
commit4d47cbdd29ba8c29876adcbb84dfba9efbd15f5f (patch)
tree183bbef0ad2fd9addf2235778b81c0d46ffe7071 /gdb/testsuite
parenta66b7a0434a9e2233801bcdb294dd6d92f57dc9b (diff)
downloadgdb-4d47cbdd29ba8c29876adcbb84dfba9efbd15f5f.zip
gdb-4d47cbdd29ba8c29876adcbb84dfba9efbd15f5f.tar.gz
gdb-4d47cbdd29ba8c29876adcbb84dfba9efbd15f5f.tar.bz2
[gdb/testsuite] Fix gdb.dwarf2/gdb-index-nodebug.exp with cc-with-gdb-index
When running with target board cc-with-gdb-index, we run into: ... (gdb) save gdb-index .^M Error while writing index for `gdb-index-nodebug': \ Cannot use an index to create the index^M (gdb) FAIL: gdb.dwarf2/gdb-index-nodebug.exp: try to save gdb index ... Fix this by detecting an already present index, and marking the test unsupported. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2021-08-02 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/gdb-index-nodebug.exp: Mark unsupported when index already present.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp23
1 files changed, 21 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp b/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
index 27b46d4..6eb34f9 100644
--- a/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
+++ b/gdb/testsuite/gdb.dwarf2/gdb-index-nodebug.exp
@@ -22,7 +22,26 @@ if {[prepare_for_testing "failed to prepare" "${testfile}" \
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 readnow_p [readnow]
+
set index_file ${testfile}.gdb-index
# The bug was that gdb would crash here.
-gdb_test_no_output "save gdb-index [file dirname ${index_file}]" \
- "try to save gdb index"
+set cmd "save gdb-index [file dirname ${index_file}]"
+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 "^$cmd" {
+ pass $gdb_test_name
+ }
+}