gdbclient: support various PT_INTERP values

gdb looks for an executable's dynamic linker using the PT_INTERP setting
from the executable. That value can be various things:
 - /system/bin/linker[64]
 - /system/bin/linker_asan[64]
 - /system/bin/bootstrap/linker[64]

Currently, only the bootstrap linker is available in the sysroot/symbols
directory. The ordinary and ASAN linkers are symlinks on the target and
are missing from the sysroot (aka symbols) directory.

Use the executable's PT_INTERP value to find the symbolized linker binary
and add it to the solib search path. If necessary, copy or pull a linker
binary.

Test: gdbclient.py -r ls
  "info sharedlib" shows $OUT/symbols/apex/com.android.runtime.debug/bin/linker64

Test: gdbclient.py -r /data/nativetest64/bionic-unit-tests/bionic-unit-tests
  "info sharedlib" shows $OUT/symbols/system/bin/bootstrap/linker64

Test: m asan_test
  gdbclient.py -r /data/nativetest64/asan_test/asan_test
  "info sharedlib" shows /tmp/gdbclient-linker-HunVs9/linker_asan64

Bug: http://b/134183407
Change-Id: I7f79943dcd9ec762d1aaf21178bb6ab3eff40617
2 files changed