[gdb/testsuite] Fix gdb.base/print-file-var.exp for remote target
When running test-case gdb.base/print-file-var.exp with target board
remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some
failures.
Fix these by using the name of a shared lib as returned by gdb_load_shlib.
This required splitting up the gdb_load_shlib functionality, which is now
defined as:
...
proc gdb_load_shlib { file } {
set dest [gdb_download_shlib $file]
gdb_locate_shlib $file
return $dest
}
...
such that we can do gdb_download_shlib before gdb is started.
Tested on x86_64-linux.
Co-Authored-by: Ivan Tetyushkin <ivan.tetyushkin@syntacore.com>