Fix gdb.python/py-connection.exp with remote targets
authorPedro Alves <pedro@palves.net>
Tue, 17 May 2022 11:53:32 +0000 (12:53 +0100)
committerPedro Alves <pedro@palves.net>
Tue, 17 May 2022 12:03:07 +0000 (13:03 +0100)
commita1f2ddd38378c8db63e75daa28b7e304c2fd774f
tree75c8b1362699513a6dced987a5838db10b692367
parent49a73ab9d345e1cd412a93b34a0b8c166603d80e
Fix gdb.python/py-connection.exp with remote targets

After the patch to make gdb_test's question non-optional when
specified, gdb.python/py-connection.exp started failing like so:

  $ make check TESTS="gdb.python/py-connection.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
  (gdb) PASS: gdb.python/py-connection.exp: info connections while the connection is still around
  disconnect^M
  Ending remote debugging.^M
  (gdb) FAIL: gdb.python/py-connection.exp: kill the inferior

The problem is that "disconnect" when debugging with the native target
asks the user whether to kill the program, while with remote targets,
it doesn't.

Fix it by explicitly killing before disconnecting.

Tested with --target_board unix, native-gdbserver, and native-extended-gdbserver.

Change-Id: Icd85015c76deb84b71894715d43853c1087eba0b
gdb/testsuite/gdb.python/py-connection.exp