8sa1-binutils-gdb/gdb/testsuite/gdb.multi
Tom de Vries f32682eaca [gdb/testsuite] Fix silent timeout in gdb.multi/multi-target.exp
While running test-case gdb.multi/multi-target.exp, I observed a silent
timeout related to "monitor exit".

By making the timeout explicit in an expect clause in gdbserver_gdb_exit:
...
+  timeout {
+    warning "Timed out waiting for EOF in server after $monitor_exit"
+  }
...
we get in the log:
...
monitor exit^M
"monitor" command not supported by this target.^M
(gdb) WARNING: Timed out waiting for EOF in server after monitor exit
...

What happens is the following:
- the inferior 5 is selected
- a breakpoint is set in inferior 1
- the breakpoint triggers and we switch to inferior 1
- setup is called by test_continue, which calls clean_restart, which calls
  gdbserver_gdb_exit (due to load_lib gdbserver-support.exp)
- gdbserver_gdb_exit issues "monitor exit"
- gdb responds with "not supported by this target" because inferior 1 is
  native

Fix this by keeping a list of server_spawn_id, and cleaning those up before
calling gdbserver_gdb_exit.

This reduces testing time from 1m22s to 32s.

gdb/testsuite/ChangeLog:

2020-04-02  Tom de Vries  <tdevries@suse.de>

	* lib/gdbserver-support.exp (gdbserver_exit): Factor out of ...
	(gdbserver_gdb_exit): ... here.  Add timeout warning.
	* gdb.multi/multi-target.exp (server_spawn_ids): New global var.
	(connect_target_extended_remote): Append new server_spawn_id to
	server_spawn_ids.
	(cleanup): New proc.
	(setup, <toplevel>): Call cleanup.
2020-04-02 09:46:00 +02:00
..
base.exp
bkpt-multi-exec.c
bkpt-multi-exec.exp
crashme.c
dummy-frame-restore.c
dummy-frame-restore.exp
goodbye.c
hangout.c
hello.c
info-threads.exp
multi-arch-exec.c
multi-arch-exec.exp
multi-arch.exp
multi-attach.c
multi-attach.exp
multi-re-run-1.c Fix re-runs of a second inferior (PR gdb/25410) 2020-01-24 18:46:20 +00:00
multi-re-run-2.c Fix re-runs of a second inferior (PR gdb/25410) 2020-01-24 18:46:20 +00:00
multi-re-run.exp Fix re-runs of a second inferior (PR gdb/25410) 2020-01-24 18:46:20 +00:00
multi-target.c
multi-target.exp [gdb/testsuite] Fix silent timeout in gdb.multi/multi-target.exp 2020-04-02 09:46:00 +02:00
multi-term-settings.c
multi-term-settings.exp
remove-inferiors.c
remove-inferiors.exp Add "info connections" command, "info inferiors" connection number/string 2020-01-10 20:06:14 +00:00
stop-all-on-exit.c gdb/infrun: stop all threads if there exists a non-stop target 2020-04-01 21:33:06 +02:00
stop-all-on-exit.exp gdb/infrun: stop all threads if there exists a non-stop target 2020-04-01 21:33:06 +02:00
tids-gid-reset.c
tids-gid-reset.exp
tids.c
tids.exp
watchpoint-multi-exit.c
watchpoint-multi-exit.exp
watchpoint-multi.c
watchpoint-multi.exp Add "info connections" command, "info inferiors" connection number/string 2020-01-10 20:06:14 +00:00