[V3,4/4] gdb/testsuite: Make hook-stop.exp ignore termination message from GDB stub

Message ID 20230901032230.4193511-5-sandra@codesourcery.com
State New
Headers
Series gdb/testsuite: Miscellaneous fixes |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

Sandra Loosemore Sept. 1, 2023, 3:22 a.m. UTC
  When a GDB stub is run via "target remote |", it sometimes produces
extra output that ends up mixed with GDB's own output.  For example,
QEMU's built-in GDB stub responds to the vKill packet by printing

nios2-elf-qemu-system: QEMU: Terminated via GDBstub

before exiting.

This patch fixes the regexp in gdb.base/hook-stop.exp to allow such
messages between GDB's "continuing" and "Inferior killed" messages.

Reviewed-By: Tom Tromey <tom@tromey.com>
---
 gdb/testsuite/gdb.base/hook-stop.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tom Tromey Sept. 5, 2023, 4:55 p.m. UTC | #1
Sandra> When a GDB stub is run via "target remote |", it sometimes produces
Sandra> extra output that ends up mixed with GDB's own output.  For example,
Sandra> QEMU's built-in GDB stub responds to the vKill packet by printing

Sandra> nios2-elf-qemu-system: QEMU: Terminated via GDBstub

Sandra> before exiting.

If you have target boards that set up & invoke qemu, I think that would
be pretty interesting to have in-tree.

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.base/hook-stop.exp b/gdb/testsuite/gdb.base/hook-stop.exp
index 0babd46aaea..50c5dfe9dc5 100644
--- a/gdb/testsuite/gdb.base/hook-stop.exp
+++ b/gdb/testsuite/gdb.base/hook-stop.exp
@@ -85,7 +85,7 @@  proc hook_stop_kill {} {
 
 	set test "run hook-stop"
 	gdb_test_multiple "continue" "$test" {
-	    -re "Continuing.\r\n\\\[Inferior $decimal \\(.*\\) killed\\\]\r\n${gdb_prompt} $" {
+	    -re "Continuing.*\r\n\\\[Inferior $decimal \\(.*\\) killed\\\]\r\n${gdb_prompt} $" {
 		pass $test
 	    }
 	}