diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 71ec4951f16..85bafbada4a 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-09-20 Pedro Alves + + * lib/mi-support.exp (mi_uncatched_gdb_exit) Switch to the main + spawn_id before calling remote_close. Close secondary MI channel. + 2020-09-20 Pedro Alves * gdb.base/testenv.exp (find_env): Bail out if printing 'envp[$i]' diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 5c1fcca4d23..0e7524ed0f6 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -89,6 +89,18 @@ proc mi_uncatched_gdb_exit {} { } } + # Switch back to the main spawn id, so that remote_close below + # closes it, and not a secondary channel. Closing a secondary + # channel does not make GDB exit. + if {$gdb_spawn_id != $gdb_main_spawn_id} { + switch_gdb_spawn_id $gdb_main_spawn_id + } + + # Close secondary MI channel, if there's one. + if {$mi_spawn_id != $gdb_main_spawn_id} { + close -i $mi_spawn_id + } + if ![is_remote host] { remote_close host }