public string[] CacheSystemLibraries(bool only64bit)
{
//
// Evaluate the remote libraries required for debugging on the host device.
//
LoggingUtils.PrintFunction ();
List<string> deviceLibraries = new List<string> ();
string libdir = (only64bit) ? "lib64" : "lib";
deviceLibraries.AddRange (new string []
{
string.Format ("/system/{0}/libandroid.so", libdir),
string.Format ("/system/{0}/libandroid_runtime.so", libdir),
//string.Format ("/system/{0}/libart.so", libdir),
string.Format ("/system/{0}/libbinder.so", libdir),
string.Format ("/system/{0}/libc.so", libdir),
//string.Format ("/system/{0}/libdvm.so", libdir),
string.Format ("/system/{0}/libEGL.so", libdir),
string.Format ("/system/{0}/libGLESv1_CM.so", libdir),
string.Format ("/system/{0}/libGLESv2.so", libdir),
string.Format ("/system/{0}/libutils.so", libdir),
});
//
// Pull the required libraries from the device.
//
List<string> hostBinaries = new List<string> ();
foreach (string binary in deviceLibraries)
{
string cachedBinary = Path.Combine (CacheSysRoot, binary.Substring (1));
string cachedBinaryDir = Path.GetDirectoryName (cachedBinary);
string cachedBinaryFullPath = Path.Combine (Path.GetDirectoryName (cachedBinary), Path.GetFileName (cachedBinary));
Directory.CreateDirectory (cachedBinaryDir);
FileInfo cachedBinaryFileInfo = new FileInfo (cachedBinaryFullPath);
bool usedCached = false;
if (cachedBinaryFileInfo.Exists && (DateTime.UtcNow - cachedBinaryFileInfo.CreationTimeUtc) < TimeSpan.FromDays (1))
{
LoggingUtils.Print (string.Format ("[GdbSetup] Using cached {0}.", binary));
hostBinaries.Add (cachedBinaryFullPath);
usedCached = true;
}
if (!usedCached)
{
try
{
Process.HostDevice.Pull (binary, cachedBinary);
hostBinaries.Add (cachedBinaryFullPath);
LoggingUtils.Print (string.Format ("[GdbSetup] Pulled {0} from device/emulator.", binary));
}
catch (Exception e)
{
LoggingUtils.HandleException (e);
}
}
}
return hostBinaries.ToArray ();
}