[gdb/testsuite] Fix silent timeout in gdb.multi/multi-target.exp
authorTom de Vries <tdevries@suse.de>
Thu, 2 Apr 2020 07:46:00 +0000 (09:46 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 2 Apr 2020 07:46:00 +0000 (09:46 +0200)
commitf32682eacae76881752bae2a72c485b98badb2c3
tree6f78ab4ed07b2f6d723f416b7e1dcb3b1b0ad95b
parent4f5bd88505801cb9b405c83a4faa4111475dbc62
[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.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.multi/multi-target.exp
gdb/testsuite/lib/gdbserver-support.exp
This page took 0.027345 seconds and 4 git commands to generate.