[Platform/Android] Read the adb server from an env variable if set

Summary:
The environment variable ANDROID_ADB_SERVER_PORT can be defined to have
adbd litsen on a different port. Teach lldb how to understand this via
simply checking the env var.

Reviewers: xiaobai, clayborg

Subscribers: srhines

Differential Revision: https://reviews.llvm.org/D66689

llvm-svn: 370106
This commit is contained in:
Nathan Lanza
2019-08-27 20:00:02 +00:00
parent 06dc817852
commit 0c01d92051

View File

@@ -137,7 +137,12 @@ const std::string &AdbClient::GetDeviceID() const { return m_device_id; }
Status AdbClient::Connect() {
Status error;
m_conn.reset(new ConnectionFileDescriptor);
m_conn->Connect("connect://localhost:5037", &error);
std::string port = "5037";
if (const char *env_port = std::getenv("ANDROID_ADB_SERVER_PORT")) {
port = env_port;
}
std::string uri = "connect://localhost:" + port;
m_conn->Connect(uri.c_str(), &error);
return error;
}