[committed,gdb/testsuite] Handle readnow in ensure_gdb_index

Message ID 20211011102912.GA21648@delia.home
State New
Headers show
Series
  • [committed,gdb/testsuite] Handle readnow in ensure_gdb_index
Related show

Commit Message

Philippe Waroquiers via Gdb-patches Oct. 11, 2021, 10:29 a.m.
Hi,

When running test-case gdb.base/with-mf.exp with target board readnow, I run
into:
...
FAIL: gdb.base/with-mf.exp: check if index present
...
This is since commit 6010fb0c49e "[gdb/testsuite] Fix full buffer in
gdb.rust/dwindex.exp".

Before that commit, the proc ensure_gdb_index would treat the line:
...
.gdb_index: faked for "readnow"^M
...
as proof that an index is already present (which is incorrect).

Now, instead it generates aforementioned FAIL and continues to generate an
index.

Fix this by explicitly handling the readnow case in proc ensure_gdb_index,
such that we bail out instead.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Handle readnow in ensure_gdb_index

---
 gdb/testsuite/lib/gdb.exp | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 6a5cdc06485..c2e6595f594 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -7922,6 +7922,7 @@  proc ensure_gdb_index { binfile {style ""} } {
     set testfile [file tail $binfile]
     set test "check if index present"
     set has_index 0
+    set has_readnow 0
     gdb_test_multiple "mt print objfiles ${testfile}" $test -lbl {
 	-re "\r\n\\.gdb_index: version ${decimal}(?=\r\n)" {
 	    set has_index 1
@@ -7934,6 +7935,10 @@  proc ensure_gdb_index { binfile {style ""} } {
 	-re "\r\nPsymtabs:(?=\r\n)" {
 	    gdb_test_lines "" $gdb_test_name ".*"
 	}
+	-re ".gdb_index: faked for \"readnow\"" {
+	    set has_readnow 1
+	    gdb_test_lines "" $gdb_test_name ".*"
+	}
 	-re -wrap "" {
 	    fail $gdb_test_name
 	}
@@ -7943,6 +7948,10 @@  proc ensure_gdb_index { binfile {style ""} } {
 	return 0
     }
 
+    if { $has_readnow } {
+	return -1
+    }
+
     if { [add_gdb_index $binfile $style] == "1" } {
 	return 1
     }