Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix timeout in gdb.threads/detach-step-over.exp with readnow
Date: Wed, 5 May 2021 15:14:01 +0200	[thread overview]
Message-ID: <20210505131356.GA26308@delia> (raw)

Hi,

When running test-case gdb.threads/detach-step-over.exp with target board
readnow, I run into:
...
Reading symbols from /lib64/libc.so.6...^M
Reading symbols from \
  /usr/lib/debug/lib64/libc-2.26.so-2.26-lp152.26.6.1.x86_64.debug...^M
Expanding full symbols from \
  /usr/lib/debug/lib64/libc-2.26.so-2.26-lp152.26.6.1.x86_64.debug...^M
FAIL: gdb.threads/detach-step-over.exp: \
  breakpoint-condition-evaluation=host: target-non-stop=on: non-stop=on: \
  displaced=off: iter 2: attach (timeout)
...

Fix this by doing exp_continue when encountering the "Reading symbols" or
"Expanding full symbols" lines.

This is still fragile and times out with a higher load, similated f.i. by
stress -c 5.  Fix that by using a timeout factor of 2.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix timeout in gdb.threads/detach-step-over.exp with readnow

gdb/testsuite/ChangeLog:

2021-05-05  Tom de Vries  <tdevries@suse.de>

	* gdb.threads/detach-step-over.exp: Do exp_continue when encountering
	"Reading symbols" or "Expanding full symbols" lines.  Using timeout
	factor of 2 for attach.

---
 gdb/testsuite/gdb.threads/detach-step-over.exp | 49 +++++++++++++++++---------
 1 file changed, 32 insertions(+), 17 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/detach-step-over.exp b/gdb/testsuite/gdb.threads/detach-step-over.exp
index 8c58aebad8a..27718551188 100644
--- a/gdb/testsuite/gdb.threads/detach-step-over.exp
+++ b/gdb/testsuite/gdb.threads/detach-step-over.exp
@@ -106,23 +106,38 @@ proc test {condition_eval target_non_stop non_stop displaced} {
 	with_test_prefix "iter $attempt" {
 	    gdb_test "inferior 1" "Switching to .*"
 
-	    set attached 0
-	    set eperm 0
-	    set test "attach"
-	    gdb_test_multiple "attach $testpid" $test {
-		-re "new threads in iteration" {
-		    # Seen when "set debug libthread_db" is on.
-		    exp_continue
-		}
-		-re "is a zombie - the process has already terminated.*$gdb_prompt " {
-		    fail $gdb_test_name
-		}
-		-re "Unable to attach: .*$gdb_prompt " {
-		    fail $gdb_test_name
-		}
-		-re "Attaching to program.*process $testpid.*$gdb_prompt " {
-		    pass $test
-		    set attached 1
+	    with_timeout_factor 2 {
+		set attached 0
+		set saw_attaching 0
+		set eperm 0
+		set test "attach"
+		gdb_test_multiple "attach $testpid" $test {
+		    -re "Attaching to program.*process $testpid\r\n" {
+			set saw_attaching 1
+			exp_continue
+		    }
+		    -re "new threads in iteration" {
+			# Seen when "set debug libthread_db" is on.
+			exp_continue
+		    }
+		    -re "Reading symbols from|Expanding full symbols from" {
+			# Prevent -readnow timeout.
+			exp_continue
+		    }
+		    -re "is a zombie - the process has already terminated.*$gdb_prompt " {
+			fail $gdb_test_name
+		    }
+		    -re "Unable to attach: .*$gdb_prompt " {
+			fail $gdb_test_name
+		    }
+		    -re "\r\n$gdb_prompt " {
+			if { $saw_attaching } {
+			    set attached 1
+			    pass $test
+			} else {
+			    fail $test
+			}
+		    }
 		}
 	    }
 

                 reply	other threads:[~2021-05-05 13:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210505131356.GA26308@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox