[gdb/testsuite] Handle host cleanfiles
authorTom de Vries <tdevries@suse.de>
Fri, 7 Oct 2022 16:08:00 +0000 (18:08 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 7 Oct 2022 16:08:00 +0000 (18:08 +0200)
commit7808a1f7f68cb38f66cf44bb91faae29b0dbfedd
treeaae9675360f9ccbb369984a502f596c7417b6865
parent8c7cb01a296c3f91372505b67be76ca41f0665a6
[gdb/testsuite] Handle host cleanfiles

When running test-case gdb.server/abspath.exp with host board
local-remote-host-notty, I get:
...
$ git sti
  ...
        deleted:    gdb/testsuite/gdb.xml/trivial.xml
...

This happens as follows.  The test-case calls skip_gdbserver_test, which calls
gdb_skip_xml_test, which does:
...
    set xml_file [gdb_remote_download host "${srcdir}/gdb.xml/trivial.xml"]
...

Then proc gdb_remote_download appends $xml_file (which for this particular
host board happens to be ${srcdir}/gdb.xml/trivial.xml) to cleanfiles, which
ends up being handled in gdb_finish by:
...
       eval remote_file target delete $cleanfiles
...

The problem is that a host file is deleted using target delete.

Fix this by splitting cleanfiles up in cleanfiles_target and cleanfiles_host.

Tested on x86_64-linux.
gdb/testsuite/lib/gdb.exp