On msys2-ucrt64, with test-case gdb.server/non-existing-program.exp I get:
...
(gdb) quit^M
gdb_caching_proc allow_xml_test caused gdb_exit to be called
gdb_caching_proc allow_xml_test marked as called
gdb_caching_proc get_mount_point_map marked as called
builtin_spawn gdbserver stdio non-existing-program^M
Error creating process "non-existing-program " (error 2): \
The system cannot find the file specified.^M^M
Exiting^M^M
FAIL: gdb.server/non-existing-program.exp: gdbserver exits cleanly
...
This happens because this regexp fails to match:
...
# This is what we get on Windows.
-re "Error creating process\r\n\r\nExiting\r\n" {
...
Fix this by updating the regexp.
Tested on x86_64-w64-mingw32 (msys2-ucrt64).
# to spawn the program before opening the connection.
set spawn_id [remote_spawn target "$gdbserver stdio non-existing-program"]
+set eol {[\r\n]}
+
set msg "gdbserver exits cleanly"
set saw_exiting 0
expect {
exp_continue
}
# This is what we get on Windows.
- -re "Error creating process\r\n\r\nExiting\r\n" {
+ -re "Error creating process.*$eol+Exiting$eol+" {
set saw_exiting 1
exp_continue
}