summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
diff options
context:
space:
mode:
authorOleksiy Vyalov <ovyalov@google.com>2015-03-25 17:58:13 +0000
committerOleksiy Vyalov <ovyalov@google.com>2015-03-25 17:58:13 +0000
commit6f001068d3263ce161ba0dd3b4b5cddbf555d09d (patch)
treef9516e27525d3a9633f149f1a985ac32d52b56f5 /lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
parentff2a64cf1bedc3196f949848fcf8773b95484c60 (diff)
downloadbcm5719-llvm-6f001068d3263ce161ba0dd3b4b5cddbf555d09d.tar.gz
bcm5719-llvm-6f001068d3263ce161ba0dd3b4b5cddbf555d09d.zip
Use Android device serial number instead of hostname as a target identifier within module cache.
http://reviews.llvm.org/D8597 llvm-svn: 233202
Diffstat (limited to 'lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp')
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 02d283b1a51..e339e03db6d 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -15,6 +15,7 @@
#include "lldb/Host/HostInfo.h"
// Project includes
+#include "AdbClient.h"
#include "PlatformAndroid.h"
#include "PlatformAndroidRemoteGDBServer.h"
@@ -171,6 +172,8 @@ PlatformAndroid::GetPluginName()
Error
PlatformAndroid::ConnectRemote (Args& args)
{
+ m_device_id.clear ();
+
if (IsHost())
{
return Error ("can't connect to the host platform '%s', always connected", GetPluginName().GetCString());
@@ -178,5 +181,24 @@ PlatformAndroid::ConnectRemote (Args& args)
if (!m_remote_platform_sp)
m_remote_platform_sp = PlatformSP(new PlatformAndroidRemoteGDBServer());
- return PlatformLinux::ConnectRemote (args);
+
+ auto error = PlatformLinux::ConnectRemote (args);
+ if (error.Success ())
+ {
+ // Fetch the device list from ADB and if only 1 device found then use that device
+ // TODO: Handle the case when more device is available
+ AdbClient adb;
+ error = AdbClient::CreateByDeviceID (nullptr, adb);
+ if (error.Fail ())
+ return error;
+
+ m_device_id = adb.GetDeviceID ();
+ }
+ return error;
+}
+
+const char *
+PlatformAndroid::GetCacheHostname ()
+{
+ return m_device_id.c_str ();
}
OpenPOWER on IntegriCloud