[Lldb-commits] [PATCH] D22052: Respect `ANDROID_SERIAL` environment variable used by ADB
Luke Drummond via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 7 11:09:56 PDT 2016
This revision was automatically updated to reflect the committed changes.
ldrumm marked an inline comment as done.
Closed by commit rL274776: Respect ANDROID_SERIAL environment variable used by ADB (authored by ldrumm).
Changed prior to commit:
http://reviews.llvm.org/D22052?vs=63055&id=63095#toc
Repository:
rL LLVM
http://reviews.llvm.org/D22052
Files:
lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
Index: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
===================================================================
--- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
+++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
@@ -25,6 +25,7 @@
#include <limits.h>
+#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <sstream>
@@ -99,19 +100,24 @@
if (error.Fail())
return error;
- if (device_id.empty())
+ std::string android_serial;
+ if (!device_id.empty())
+ android_serial = device_id;
+ else if (const char *env_serial = std::getenv("ANDROID_SERIAL"))
+ android_serial = env_serial;
+
+ if (android_serial.empty())
{
if (connect_devices.size() != 1)
- return Error("Expected a single connected device, got instead %" PRIu64,
- static_cast<uint64_t>(connect_devices.size()));
-
+ return Error("Expected a single connected device, got instead %zu - try setting 'ANDROID_SERIAL'",
+ connect_devices.size());
adb.SetDeviceID(connect_devices.front());
}
else
{
- auto find_it = std::find(connect_devices.begin(), connect_devices.end(), device_id);
+ auto find_it = std::find(connect_devices.begin(), connect_devices.end(), android_serial);
if (find_it == connect_devices.end())
- return Error("Device \"%s\" not found", device_id.c_str());
+ return Error("Device \"%s\" not found", android_serial.c_str());
adb.SetDeviceID(*find_it);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22052.63095.patch
Type: text/x-patch
Size: 1598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160707/ba59d20f/attachment.bin>
More information about the lldb-commits
mailing list