[Lldb-commits] [lldb] r370106 - [Platform/Android] Read the adb server from an env variable if set

Nathan Lanza via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 27 13:00:02 PDT 2019


Author: lanza
Date: Tue Aug 27 13:00:02 2019
New Revision: 370106

URL: http://llvm.org/viewvc/llvm-project?rev=370106&view=rev
Log:
[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

Modified:
    lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp

Modified: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp?rev=370106&r1=370105&r2=370106&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp Tue Aug 27 13:00:02 2019
@@ -137,7 +137,12 @@ const std::string &AdbClient::GetDeviceI
 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;
 }




More information about the lldb-commits mailing list