summaryrefslogtreecommitdiff
path: root/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp')
-rw-r--r--source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
index 034518c1d2e35..dbc74833e2870 100644
--- a/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
+++ b/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
@@ -10,8 +10,8 @@
// Other libraries and framework includes
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/common/TCPSocket.h"
-#include "lldb/Utility/Error.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Status.h"
#include "lldb/Utility/UriParser.h"
#include "PlatformAndroidRemoteGDBServer.h"
@@ -25,7 +25,7 @@ using namespace platform_android;
static const lldb::pid_t g_remote_platform_pid =
0; // Alias for the process id of lldb-platform
-static Error ForwardPortWithAdb(
+static Status ForwardPortWithAdb(
const uint16_t local_port, const uint16_t remote_port,
llvm::StringRef remote_socket_name,
const llvm::Optional<AdbClient::UnixSocketNamespace> &socket_namespace,
@@ -53,20 +53,20 @@ static Error ForwardPortWithAdb(
remote_socket_name.str().c_str(), local_port);
if (!socket_namespace)
- return Error("Invalid socket namespace");
+ return Status("Invalid socket namespace");
return adb.SetPortForwarding(local_port, remote_socket_name,
*socket_namespace);
}
-static Error DeleteForwardPortWithAdb(uint16_t local_port,
- const std::string &device_id) {
+static Status DeleteForwardPortWithAdb(uint16_t local_port,
+ const std::string &device_id) {
AdbClient adb(device_id);
return adb.DeletePortForwarding(local_port);
}
-static Error FindUnusedPort(uint16_t &port) {
- Error error;
+static Status FindUnusedPort(uint16_t &port) {
+ Status error;
std::unique_ptr<TCPSocket> tcp_socket(new TCPSocket(true, false));
if (error.Fail())
return error;
@@ -107,19 +107,20 @@ bool PlatformAndroidRemoteGDBServer::KillSpawnedProcess(lldb::pid_t pid) {
return m_gdb_client.KillSpawnedProcess(pid);
}
-Error PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) {
+Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) {
m_device_id.clear();
if (args.GetArgumentCount() != 1)
- return Error("\"platform connect\" takes a single argument: <connect-url>");
+ return Status(
+ "\"platform connect\" takes a single argument: <connect-url>");
int remote_port;
llvm::StringRef scheme, host, path;
const char *url = args.GetArgumentAtIndex(0);
if (!url)
- return Error("URL is null.");
+ return Status("URL is null.");
if (!UriParser::Parse(url, scheme, host, remote_port, path))
- return Error("Invalid URL: %s", url);
+ return Status("Invalid URL: %s", url);
if (host != "localhost")
m_device_id = host;
@@ -150,7 +151,7 @@ Error PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) {
return error;
}
-Error PlatformAndroidRemoteGDBServer::DisconnectRemote() {
+Status PlatformAndroidRemoteGDBServer::DisconnectRemote() {
DeleteForwardPort(g_remote_platform_pid);
return PlatformRemoteGDBServer::DisconnectRemote();
}
@@ -173,12 +174,12 @@ void PlatformAndroidRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) {
m_port_forwards.erase(it);
}
-Error PlatformAndroidRemoteGDBServer::MakeConnectURL(
+Status PlatformAndroidRemoteGDBServer::MakeConnectURL(
const lldb::pid_t pid, const uint16_t remote_port,
llvm::StringRef remote_socket_name, std::string &connect_url) {
static const int kAttempsNum = 5;
- Error error;
+ Status error;
// There is a race possibility that somebody will occupy
// a port while we're in between FindUnusedPort and ForwardPortWithAdb -
// adding the loop to mitigate such problem.
@@ -205,7 +206,7 @@ Error PlatformAndroidRemoteGDBServer::MakeConnectURL(
lldb::ProcessSP PlatformAndroidRemoteGDBServer::ConnectProcess(
llvm::StringRef connect_url, llvm::StringRef plugin_name,
lldb_private::Debugger &debugger, lldb_private::Target *target,
- lldb_private::Error &error) {
+ lldb_private::Status &error) {
// We don't have the pid of the remote gdbserver when it isn't started by us
// but we still want
// to store the list of port forwards we set up in our port forward map.