[PATCH] gdb/testsuite/gdb.rocm: Fix incorrect use of continue N in multi-inferior-gpu.exp

Lancelot Six
2023-10-17T11:17:03Z

The gdb.rocm/multi-inferior-gpu.exp testcase uses a "continue $thread"
command, but this is incorrect. If "continue" is given an argument, it
sets the ignore count of the breakpoint the thread stopped at.

For this testcase it does not really matter since the breakpoint is not
meant to be hit anymore, so whatever the ignore count is won't influence
the outcome of the test. It is worth fixing nevertheless.

While at changing it, switch to using "continue&" to consume the GDB
prompt right away. This makes the following pattern matching more
reliable.

Change-Id: I0eb674d5529cdeb9e808b74870a29b6077265737
---
gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp
index 18b4172ff09..958b70e6df1 100644
--- a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp
+++ b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp
@@ -68,8 +68,10 @@ proc do_test {} {
foreach thread $stopped_gpu_threads {
set infnumber [lindex [split $thread .] 0]
gdb_test "thread $thread" "Switching to thread.*"
- gdb_test_multiple "continue $thread" "" {
- -re "\\\[Inferior $infnumber \[^\n\r\]* exited normally\\]\r\n$::gdb_prompt " {
+ # Continue this thread, and consime the prompt
+ gdb_test "continue&" "" "continue GPU thread in $infnumber"
+ gdb_test_multiple "" "wait for inferior $infnumber" {
+ -re "\\\[Inferior $infnumber \[^\n\r\]* exited normally\\\]\r\n" {
pass $gdb_test_name
}
}
--
2.34.1