scripts: remote-gdb: fix target / libc matching on directory names