]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] fix gdb.server/server-kill.exp
authorSébastien Darche <sdarche@efficios.com>
Fri, 26 Sep 2025 20:37:54 +0000 (16:37 -0400)
committerSébastien Darche <sdarche@efficios.com>
Wed, 8 Oct 2025 19:43:33 +0000 (15:43 -0400)
A test case in gdb.server/server-kill.exp attempts to query the server
status after the server it is connected to has been killed. The
connection is reset as expected, but the regex on the error message
seems to be out-of-date. The test expects:

Remote communication error.  Target disconnected: Connection reset by peer.

But a modern build of gdb yields :

Remote communication error.  Target disconnected: error while reading: Connection reset by peer.

I presume this is due to change 0da23004a064 ("Change serial_readchar to
throw") which added exceptions to the control flow handling instead of
relying on perror(). The exception error string inserts "error while
reading" to the perror message.

The test appeared to fail intermittently, sometimes matching the first
part of the regex ("Remote connection closed"). It now passes
consistently.

Change-Id: I3bf364b5d4b56de67f9ca30e9d636d3bb1be4119
Approved-by: Kevin Buettner <kevinb@redhat.com>
gdb/testsuite/gdb.server/server-kill.exp

index 0c54918598c2041a9de4d933d1bb7cb13fba21a7..f01f5e3912a6304b847edc875bc10980302a9404 100644 (file)
@@ -97,7 +97,7 @@ proc_with_prefix test_tstatus {} {
 
     # Force GDB to talk with GDBserver, so that we can get the
     # "connection closed" error.
-    gdb_test "tstatus" {Remote connection closed|Remote communication error\.  Target disconnected: Connection reset by peer\.}
+    gdb_test "tstatus" {Remote connection closed|Remote communication error\.  Target disconnected: error while reading: Connection reset by peer\.}
 }
 
 # Test unwinding with no debug/unwind info, right after the connection
@@ -152,4 +152,3 @@ test_tstatus
 test_unwind_nosyms
 test_unwind_syms
 test_stepi
-