public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] [gdb/testsuite] Fix gdb.threads/step-bg-decr-pc-switch-thread.exp for native-gdbserver
@ 2023-03-13 15:47 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-03-13 15:47 UTC (permalink / raw)
  To: gdb-patches

With test-case gdb.threads/step-bg-decr-pc-switch-thread.exp and target board
native-gdbserver, I run into:
...
(gdb) UNSUPPORTED: gdb.threads/step-bg-decr-pc-switch-thread.exp: \
  switch to main thread
Remote debugging from host ::1, port 43914^M
monitor exit^M
Cannot execute this command while the target is running.^M
Use the "interrupt" command to stop the target^M
and then try again.^M
(gdb) WARNING: Timed out waiting for EOF in server after monitor exit
...

Fix this by following the advice and issuing an interrupt command, allowing
the following monitor exit command to succeed.

Tested on x86_64-linux.
---
 .../gdb.threads/step-bg-decr-pc-switch-thread.exp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
index 44899f6afa7..ee7c374c7ac 100644
--- a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
+++ b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
@@ -55,11 +55,22 @@ gdb_test_no_output "next&" "next& over inf loop"
 set test "switch to main thread"
 gdb_test_multiple "thread 1" $test {
     -re "Cannot execute this command while the target is running.*$gdb_prompt $" {
-	unsupported $test
-
+	
 	# With remote targets, we can't send any other remote packet
 	# until the target stops.  Switching thread wants to ask the
 	# remote side whether the thread is alive.
+	unsupported $gdb_test_name
+
+	# Interrupt running target to allow subsequent "monitor exit" to
+	# succeed.
+	gdb_test_multiple interrupt "" {
+	    -re -wrap "" {
+		exp_continue
+	    }
+	    -re "received signal SIGINT, Interrupt\\.\r\n.*" {
+		pass $gdb_test_name
+	    }
+	}
 	return
     }
     -re "Switching to thread 1.*\\(running\\)\r\n$gdb_prompt " {

base-commit: 66889870fa635c4cc034ffb7ade24087361da75d
-- 
2.35.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-13 15:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 15:47 [pushed] [gdb/testsuite] Fix gdb.threads/step-bg-decr-pc-switch-thread.exp for native-gdbserver Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).