]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix check-read1 FAIL with gdb.base/maint.exp
authorTom de Vries <tdevries@suse.de>
Sun, 15 Mar 2020 09:43:43 +0000 (10:43 +0100)
committerTom de Vries <tdevries@suse.de>
Sun, 15 Mar 2020 09:43:43 +0000 (10:43 +0100)
When running test-case gdb.base/maint.exp with check-read1, I run into:
...
FAIL: gdb.base/maint.exp: (timeout) maint print objfiles
...

The FAIL happens because command output contains long lines like this:
...
file1 at $hex, file2 at $hex, ..., $file$n at $hex,
...
F.i., such a line for libc.so.debug contains 82000 chars.

Fix this this by reading long lines bit by bit.

Also, replace the testing of the command output formulated using a gdb_send
combined with gdb_expect-in-a-loop, with a regular gdb_test_multiple with
exp_continue.

Tested on x86_64-linux, with make targets check and check-read1.

gdb/testsuite/ChangeLog:

2020-03-15  Tom de Vries  <tdevries@suse.de>

* gdb.base/maint.exp: Use exp_continue in long lines for "maint print
objfiles".

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/maint.exp

index a3114d3f574614e85442d381be88b98a47146c72..7c3fd4cf4cba4539a7e776dbef350ed3b022656e 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-15  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.base/maint.exp: Use exp_continue in long lines for "maint print
+       objfiles".
+
 2020-03-14  Tom Tromey  <tom@tromey.com>
 
        * gdb.base/cvexpr.exp: Add test for _Atomic and restrict.
index f6eeb98a205cc4872517093816fddd01f6d34108..3431f2c6dc54436ec1bc0de53ba63b0f50e181b1 100644 (file)
@@ -215,7 +215,7 @@ gdb_expect  {
 # There aren't any ...
 gdb_test_no_output "maint print dummy-frames"
 
-send_gdb "maint print objfiles\n"
+
 
 # To avoid timeouts, we avoid expects with many .* patterns that match
 # many lines.  Instead, we keep track of which milestones we've seen
@@ -224,31 +224,24 @@ send_gdb "maint print objfiles\n"
 set header 0
 set psymtabs 0
 set symtabs 0
-set keep_looking 1
-
-while {$keep_looking} {
-    gdb_expect  {
-
-       -re "\r\n" {
-           set output $expect_out(buffer)
-           if {[regexp ".*Object file.*maint($EXEEXT)?:  Objfile at ${hex}" $output]} {
-               set header 1
-           }
-           if {[regexp ".*Psymtabs:\[\r\t \]+\n" $output]} {
-               set psymtabs 1
-           }
-           if {[regexp ".*Symtabs:\[\r\t \]+\n" $output]} {
-               set symtabs 1
-           }
-       }
-
-       -re ".*$gdb_prompt $" { 
-           set keep_looking 0
-       }
-       timeout { 
-           fail "(timeout) maint print objfiles" 
-           set keep_looking 0
-       }
+gdb_test_multiple "maint print objfiles" "" -lbl {
+    -re "\r\nObject file.*maint($EXEEXT)?:  Objfile at ${hex}" {
+       set header 1
+       exp_continue
+    }
+    -re "\r\nPsymtabs:\[\r\t \]+" {
+       set psymtabs 1
+       exp_continue
+    }
+    -re "\r\nSymtabs:\[\r\t \]+\n" {
+       set symtabs 1
+       exp_continue
+    }
+    -re " at $hex," {
+       exp_continue
+    }
+    -re -wrap "" {
+       pass $gdb_test_name
     }
 }