summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp')
-rw-r--r--lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 7bc3287d035..3bd628b263d 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/HostInfo.h"
+#include "Utility/UriParser.h"
// Project includes
#include "AdbClient.h"
@@ -171,9 +172,9 @@ PlatformAndroid::GetPluginName()
}
Error
-PlatformAndroid::ConnectRemote (Args& args)
+PlatformAndroid::ConnectRemote(Args& args)
{
- m_device_id.clear ();
+ m_device_id.clear();
if (IsHost())
{
@@ -183,17 +184,25 @@ PlatformAndroid::ConnectRemote (Args& args)
if (!m_remote_platform_sp)
m_remote_platform_sp = PlatformSP(new PlatformAndroidRemoteGDBServer());
- auto error = PlatformLinux::ConnectRemote (args);
- if (error.Success ())
+ int port;
+ std::string scheme, host, path;
+ const char *url = args.GetArgumentAtIndex(0);
+ if (!url)
+ return Error("URL is null.");
+ if (!UriParser::Parse(url, scheme, host, port, path))
+ return Error("Invalid URL: %s", url);
+ if (scheme == "adb")
+ m_device_id = host;
+
+ 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 ())
+ error = AdbClient::CreateByDeviceID(m_device_id, adb);
+ if (error.Fail())
return error;
- m_device_id = adb.GetDeviceID ();
+ m_device_id = adb.GetDeviceID();
}
return error;
}
OpenPOWER on IntegriCloud