LLDB mainline
AdbClient.cpp
Go to the documentation of this file.
1//===-- AdbClient.cpp -----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "AdbClient.h"
10
11#include "llvm/ADT/STLExtras.h"
12#include "llvm/ADT/SmallVector.h"
13#include "llvm/ADT/StringRef.h"
14#include "llvm/Support/FileUtilities.h"
15
18#include "lldb/Host/PosixApi.h"
26
27#include <climits>
28
29#include <algorithm>
30#include <cstdlib>
31#include <fstream>
32#include <sstream>
33
34// On Windows, transitive dependencies pull in <Windows.h>, which defines a
35// macro that clashes with a method name.
36#ifdef SendMessage
37#undef SendMessage
38#endif
39
40using namespace lldb;
41using namespace lldb_private;
42using namespace lldb_private::platform_android;
43using namespace std::chrono;
44
45static const seconds kReadTimeout(20);
46static const char *kOKAY = "OKAY";
47static const char *kFAIL = "FAIL";
48static const char *kDATA = "DATA";
49static const char *kDONE = "DONE";
50
51static const char *kSEND = "SEND";
52static const char *kRECV = "RECV";
53static const char *kSTAT = "STAT";
54
55static const size_t kSyncPacketLen = 8;
56// Maximum size of a filesync DATA packet.
57static const size_t kMaxPushData = 2 * 1024;
58// Default mode for pushed files.
59static const uint32_t kDefaultMode = 0100770; // S_IFREG | S_IRWXU | S_IRWXG
60
61static const char *kSocketNamespaceAbstract = "localabstract";
62static const char *kSocketNamespaceFileSystem = "localfilesystem";
63
64static Status ReadAllBytes(Connection &conn, void *buffer, size_t size) {
65
67 ConnectionStatus status;
68 char *read_buffer = static_cast<char *>(buffer);
69
70 auto now = steady_clock::now();
71 const auto deadline = now + kReadTimeout;
72 size_t total_read_bytes = 0;
73 while (total_read_bytes < size && now < deadline) {
74 auto read_bytes =
75 conn.Read(read_buffer + total_read_bytes, size - total_read_bytes,
76 duration_cast<microseconds>(deadline - now), status, &error);
77 if (error.Fail())
78 return error;
79 total_read_bytes += read_bytes;
80 if (status != eConnectionStatusSuccess)
81 break;
82 now = steady_clock::now();
83 }
84 if (total_read_bytes < size)
85 error = Status(
86 "Unable to read requested number of bytes. Connection status: %d.",
87 status);
88 return error;
89}
90
91Status AdbClient::CreateByDeviceID(const std::string &device_id,
92 AdbClient &adb) {
94 std::string android_serial;
95 if (!device_id.empty())
96 android_serial = device_id;
97 else if (const char *env_serial = std::getenv("ANDROID_SERIAL"))
98 android_serial = env_serial;
99
100 if (android_serial.empty()) {
101 DeviceIDList connected_devices;
102 error = adb.GetDevices(connected_devices);
103 if (error.Fail())
104 return error;
105
106 if (connected_devices.size() != 1)
107 return Status("Expected a single connected device, got instead %zu - try "
108 "setting 'ANDROID_SERIAL'",
109 connected_devices.size());
110 adb.SetDeviceID(connected_devices.front());
111 } else {
112 adb.SetDeviceID(android_serial);
113 }
114 return error;
115}
116
117AdbClient::AdbClient() = default;
118
119AdbClient::AdbClient(const std::string &device_id) : m_device_id(device_id) {}
120
121AdbClient::~AdbClient() = default;
122
123void AdbClient::SetDeviceID(const std::string &device_id) {
124 m_device_id = device_id;
125}
126
127const std::string &AdbClient::GetDeviceID() const { return m_device_id; }
128
131 m_conn = std::make_unique<ConnectionFileDescriptor>();
132 std::string port = "5037";
133 if (const char *env_port = std::getenv("ANDROID_ADB_SERVER_PORT")) {
134 port = env_port;
135 }
136 std::string uri = "connect://127.0.0.1:" + port;
137 m_conn->Connect(uri.c_str(), &error);
138
139 return error;
140}
141
143 device_list.clear();
144
145 auto error = SendMessage("host:devices");
146 if (error.Fail())
147 return error;
148
150 if (error.Fail())
151 return error;
152
153 std::vector<char> in_buffer;
154 error = ReadMessage(in_buffer);
155
156 llvm::StringRef response(&in_buffer[0], in_buffer.size());
157 llvm::SmallVector<llvm::StringRef, 4> devices;
158 response.split(devices, "\n", -1, false);
159
160 for (const auto &device : devices)
161 device_list.push_back(std::string(device.split('\t').first));
162
163 // Force disconnect since ADB closes connection after host:devices response
164 // is sent.
165 m_conn.reset();
166 return error;
167}
168
169Status AdbClient::SetPortForwarding(const uint16_t local_port,
170 const uint16_t remote_port) {
171 char message[48];
172 snprintf(message, sizeof(message), "forward:tcp:%d;tcp:%d", local_port,
173 remote_port);
174
175 const auto error = SendDeviceMessage(message);
176 if (error.Fail())
177 return error;
178
179 return ReadResponseStatus();
180}
181
182Status
183AdbClient::SetPortForwarding(const uint16_t local_port,
184 llvm::StringRef remote_socket_name,
185 const UnixSocketNamespace socket_namespace) {
186 char message[PATH_MAX];
187 const char *sock_namespace_str =
188 (socket_namespace == UnixSocketNamespaceAbstract)
191 snprintf(message, sizeof(message), "forward:tcp:%d;%s:%s", local_port,
192 sock_namespace_str, remote_socket_name.str().c_str());
193
194 const auto error = SendDeviceMessage(message);
195 if (error.Fail())
196 return error;
197
198 return ReadResponseStatus();
199}
200
201Status AdbClient::DeletePortForwarding(const uint16_t local_port) {
202 char message[32];
203 snprintf(message, sizeof(message), "killforward:tcp:%d", local_port);
204
205 const auto error = SendDeviceMessage(message);
206 if (error.Fail())
207 return error;
208
209 return ReadResponseStatus();
210}
211
212Status AdbClient::SendMessage(const std::string &packet, const bool reconnect) {
214 if (!m_conn || reconnect) {
215 error = Connect();
216 if (error.Fail())
217 return error;
218 }
219
220 char length_buffer[5];
221 snprintf(length_buffer, sizeof(length_buffer), "%04x",
222 static_cast<int>(packet.size()));
223
224 ConnectionStatus status;
225
226 m_conn->Write(length_buffer, 4, status, &error);
227 if (error.Fail())
228 return error;
229
230 m_conn->Write(packet.c_str(), packet.size(), status, &error);
231 return error;
232}
233
234Status AdbClient::SendDeviceMessage(const std::string &packet) {
235 std::ostringstream msg;
236 msg << "host-serial:" << m_device_id << ":" << packet;
237 return SendMessage(msg.str());
238}
239
240Status AdbClient::ReadMessage(std::vector<char> &message) {
241 message.clear();
242
243 char buffer[5];
244 buffer[4] = 0;
245
246 auto error = ReadAllBytes(buffer, 4);
247 if (error.Fail())
248 return error;
249
250 unsigned int packet_len = 0;
251 sscanf(buffer, "%x", &packet_len);
252
253 message.resize(packet_len, 0);
254 error = ReadAllBytes(&message[0], packet_len);
255 if (error.Fail())
256 message.clear();
257
258 return error;
259}
260
261Status AdbClient::ReadMessageStream(std::vector<char> &message,
262 milliseconds timeout) {
263 auto start = steady_clock::now();
264 message.clear();
265
268 char buffer[1024];
269 while (error.Success() && status == lldb::eConnectionStatusSuccess) {
270 auto end = steady_clock::now();
271 auto elapsed = end - start;
272 if (elapsed >= timeout)
273 return Status("Timed out");
274
275 size_t n = m_conn->Read(buffer, sizeof(buffer),
276 duration_cast<microseconds>(timeout - elapsed),
277 status, &error);
278 if (n > 0)
279 message.insert(message.end(), &buffer[0], &buffer[n]);
280 }
281 return error;
282}
283
285 char response_id[5];
286
287 static const size_t packet_len = 4;
288 response_id[packet_len] = 0;
289
290 auto error = ReadAllBytes(response_id, packet_len);
291 if (error.Fail())
292 return error;
293
294 if (strncmp(response_id, kOKAY, packet_len) != 0)
295 return GetResponseError(response_id);
296
297 return error;
298}
299
300Status AdbClient::GetResponseError(const char *response_id) {
301 if (strcmp(response_id, kFAIL) != 0)
302 return Status("Got unexpected response id from adb: \"%s\"", response_id);
303
304 std::vector<char> error_message;
305 auto error = ReadMessage(error_message);
306 if (error.Success())
307 error.SetErrorString(
308 std::string(&error_message[0], error_message.size()).c_str());
309
310 return error;
311}
312
314 std::ostringstream msg;
315 msg << "host:transport:" << m_device_id;
316
317 auto error = SendMessage(msg.str());
318 if (error.Fail())
319 return error;
320
321 return ReadResponseStatus();
322}
323
326 if (error.Fail())
327 return Status("Failed to switch to device transport: %s",
328 error.AsCString());
329
330 error = Sync();
331 if (error.Fail())
332 return Status("Sync failed: %s", error.AsCString());
333
334 return error;
335}
336
338 auto error = SendMessage("sync:", false);
339 if (error.Fail())
340 return error;
341
342 return ReadResponseStatus();
343}
344
345Status AdbClient::ReadAllBytes(void *buffer, size_t size) {
346 return ::ReadAllBytes(*m_conn, buffer, size);
347}
348
349Status AdbClient::internalShell(const char *command, milliseconds timeout,
350 std::vector<char> &output_buf) {
351 output_buf.clear();
352
354 if (error.Fail())
355 return Status("Failed to switch to device transport: %s",
356 error.AsCString());
357
358 StreamString adb_command;
359 adb_command.Printf("shell:%s", command);
360 error = SendMessage(std::string(adb_command.GetString()), false);
361 if (error.Fail())
362 return error;
363
365 if (error.Fail())
366 return error;
367
368 error = ReadMessageStream(output_buf, timeout);
369 if (error.Fail())
370 return error;
371
372 // ADB doesn't propagate return code of shell execution - if
373 // output starts with /system/bin/sh: most likely command failed.
374 static const char *kShellPrefix = "/system/bin/sh:";
375 if (output_buf.size() > strlen(kShellPrefix)) {
376 if (!memcmp(&output_buf[0], kShellPrefix, strlen(kShellPrefix)))
377 return Status("Shell command %s failed: %s", command,
378 std::string(output_buf.begin(), output_buf.end()).c_str());
379 }
380
381 return Status();
382}
383
384Status AdbClient::Shell(const char *command, milliseconds timeout,
385 std::string *output) {
386 std::vector<char> output_buffer;
387 auto error = internalShell(command, timeout, output_buffer);
388 if (error.Fail())
389 return error;
390
391 if (output)
392 output->assign(output_buffer.begin(), output_buffer.end());
393 return error;
394}
395
396Status AdbClient::ShellToFile(const char *command, milliseconds timeout,
397 const FileSpec &output_file_spec) {
398 std::vector<char> output_buffer;
399 auto error = internalShell(command, timeout, output_buffer);
400 if (error.Fail())
401 return error;
402
403 const auto output_filename = output_file_spec.GetPath();
404 std::error_code EC;
405 llvm::raw_fd_ostream dst(output_filename, EC, llvm::sys::fs::OF_None);
406 if (EC)
407 return Status("Unable to open local file %s", output_filename.c_str());
408
409 dst.write(&output_buffer[0], output_buffer.size());
410 dst.close();
411 if (dst.has_error())
412 return Status("Failed to write file %s", output_filename.c_str());
413 return Status();
414}
415
416std::unique_ptr<AdbClient::SyncService>
418 std::unique_ptr<SyncService> sync_service;
419 error = StartSync();
420 if (error.Success())
421 sync_service.reset(new SyncService(std::move(m_conn)));
422
423 return sync_service;
424}
425
427 const FileSpec &local_file) {
428 const auto local_file_path = local_file.GetPath();
429 llvm::FileRemover local_file_remover(local_file_path);
430
431 std::error_code EC;
432 llvm::raw_fd_ostream dst(local_file_path, EC, llvm::sys::fs::OF_None);
433 if (EC)
434 return Status("Unable to open local file %s", local_file_path.c_str());
435
436 const auto remote_file_path = remote_file.GetPath(false);
437 auto error = SendSyncRequest(kRECV, remote_file_path.length(),
438 remote_file_path.c_str());
439 if (error.Fail())
440 return error;
441
442 std::vector<char> chunk;
443 bool eof = false;
444 while (!eof) {
445 error = PullFileChunk(chunk, eof);
446 if (error.Fail())
447 return error;
448 if (!eof)
449 dst.write(&chunk[0], chunk.size());
450 }
451 dst.close();
452 if (dst.has_error())
453 return Status("Failed to write file %s", local_file_path.c_str());
454
455 local_file_remover.releaseFile();
456 return error;
457}
458
460 const FileSpec &remote_file) {
461 const auto local_file_path(local_file.GetPath());
462 std::ifstream src(local_file_path.c_str(), std::ios::in | std::ios::binary);
463 if (!src.is_open())
464 return Status("Unable to open local file %s", local_file_path.c_str());
465
466 std::stringstream file_description;
467 file_description << remote_file.GetPath(false).c_str() << "," << kDefaultMode;
468 std::string file_description_str = file_description.str();
469 auto error = SendSyncRequest(kSEND, file_description_str.length(),
470 file_description_str.c_str());
471 if (error.Fail())
472 return error;
473
474 char chunk[kMaxPushData];
475 while (!src.eof() && !src.read(chunk, kMaxPushData).bad()) {
476 size_t chunk_size = src.gcount();
477 error = SendSyncRequest(kDATA, chunk_size, chunk);
478 if (error.Fail())
479 return Status("Failed to send file chunk: %s", error.AsCString());
480 }
481 error = SendSyncRequest(
482 kDONE, llvm::sys::toTimeT(FileSystem::Instance().GetModificationTime(local_file)),
483 nullptr);
484 if (error.Fail())
485 return error;
486
487 std::string response_id;
488 uint32_t data_len;
489 error = ReadSyncHeader(response_id, data_len);
490 if (error.Fail())
491 return Status("Failed to read DONE response: %s", error.AsCString());
492 if (response_id == kFAIL) {
493 std::string error_message(data_len, 0);
494 error = ReadAllBytes(&error_message[0], data_len);
495 if (error.Fail())
496 return Status("Failed to read DONE error message: %s", error.AsCString());
497 return Status("Failed to push file: %s", error_message.c_str());
498 } else if (response_id != kOKAY)
499 return Status("Got unexpected DONE response: %s", response_id.c_str());
500
501 // If there was an error reading the source file, finish the adb file
502 // transfer first so that adb isn't expecting any more data.
503 if (src.bad())
504 return Status("Failed read on %s", local_file_path.c_str());
505 return error;
506}
507
509 uint32_t &mode, uint32_t &size,
510 uint32_t &mtime) {
511 const std::string remote_file_path(remote_file.GetPath(false));
512 auto error = SendSyncRequest(kSTAT, remote_file_path.length(),
513 remote_file_path.c_str());
514 if (error.Fail())
515 return Status("Failed to send request: %s", error.AsCString());
516
517 static const size_t stat_len = strlen(kSTAT);
518 static const size_t response_len = stat_len + (sizeof(uint32_t) * 3);
519
520 std::vector<char> buffer(response_len);
521 error = ReadAllBytes(&buffer[0], buffer.size());
522 if (error.Fail())
523 return Status("Failed to read response: %s", error.AsCString());
524
525 DataExtractor extractor(&buffer[0], buffer.size(), eByteOrderLittle,
526 sizeof(void *));
527 offset_t offset = 0;
528
529 const void *command = extractor.GetData(&offset, stat_len);
530 if (!command)
531 return Status("Failed to get response command");
532 const char *command_str = static_cast<const char *>(command);
533 if (strncmp(command_str, kSTAT, stat_len))
534 return Status("Got invalid stat command: %s", command_str);
535
536 mode = extractor.GetU32(&offset);
537 size = extractor.GetU32(&offset);
538 mtime = extractor.GetU32(&offset);
539 return Status();
540}
541
543 const FileSpec &local_file) {
544 return executeCommand([this, &remote_file, &local_file]() {
545 return internalPullFile(remote_file, local_file);
546 });
547}
548
550 const FileSpec &remote_file) {
551 return executeCommand([this, &local_file, &remote_file]() {
552 return internalPushFile(local_file, remote_file);
553 });
554}
555
556Status AdbClient::SyncService::Stat(const FileSpec &remote_file, uint32_t &mode,
557 uint32_t &size, uint32_t &mtime) {
558 return executeCommand([this, &remote_file, &mode, &size, &mtime]() {
559 return internalStat(remote_file, mode, size, mtime);
560 });
561}
562
564 return m_conn && m_conn->IsConnected();
565}
566
567AdbClient::SyncService::SyncService(std::unique_ptr<Connection> &&conn)
568 : m_conn(std::move(conn)) {}
569
570Status
571AdbClient::SyncService::executeCommand(const std::function<Status()> &cmd) {
572 if (!m_conn)
573 return Status("SyncService is disconnected");
574
575 const auto error = cmd();
576 if (error.Fail())
577 m_conn.reset();
578
579 return error;
580}
581
583
585 const uint32_t data_len,
586 const void *data) {
587 DataEncoder encoder(eByteOrderLittle, sizeof(void *));
588 encoder.AppendData(llvm::StringRef(request_id));
589 encoder.AppendU32(data_len);
590 llvm::ArrayRef<uint8_t> bytes = encoder.GetData();
592 ConnectionStatus status;
593 m_conn->Write(bytes.data(), kSyncPacketLen, status, &error);
594 if (error.Fail())
595 return error;
596
597 if (data)
598 m_conn->Write(data, data_len, status, &error);
599 return error;
600}
601
603 uint32_t &data_len) {
604 char buffer[kSyncPacketLen];
605
606 auto error = ReadAllBytes(buffer, kSyncPacketLen);
607 if (error.Success()) {
608 response_id.assign(&buffer[0], 4);
609 DataExtractor extractor(&buffer[4], 4, eByteOrderLittle, sizeof(void *));
610 offset_t offset = 0;
611 data_len = extractor.GetU32(&offset);
612 }
613
614 return error;
615}
616
618 bool &eof) {
619 buffer.clear();
620
621 std::string response_id;
622 uint32_t data_len;
623 auto error = ReadSyncHeader(response_id, data_len);
624 if (error.Fail())
625 return error;
626
627 if (response_id == kDATA) {
628 buffer.resize(data_len, 0);
629 error = ReadAllBytes(&buffer[0], data_len);
630 if (error.Fail())
631 buffer.clear();
632 } else if (response_id == kDONE) {
633 eof = true;
634 } else if (response_id == kFAIL) {
635 std::string error_message(data_len, 0);
636 error = ReadAllBytes(&error_message[0], data_len);
637 if (error.Fail())
638 return Status("Failed to read pull error message: %s", error.AsCString());
639 return Status("Failed to pull file: %s", error_message.c_str());
640 } else
641 return Status("Pull failed with unknown response: %s", response_id.c_str());
642
643 return Status();
644}
645
647 return ::ReadAllBytes(*m_conn, buffer, size);
648}
static Status ReadAllBytes(Connection &conn, void *buffer, size_t size)
Definition: AdbClient.cpp:64
static const char * kSTAT
Definition: AdbClient.cpp:53
static const size_t kSyncPacketLen
Definition: AdbClient.cpp:55
static const char * kSocketNamespaceAbstract
Definition: AdbClient.cpp:61
static const seconds kReadTimeout(20)
static const char * kSocketNamespaceFileSystem
Definition: AdbClient.cpp:62
static const char * kDATA
Definition: AdbClient.cpp:48
static const char * kRECV
Definition: AdbClient.cpp:52
static const char * kSEND
Definition: AdbClient.cpp:51
static const char * kOKAY
Definition: AdbClient.cpp:46
static const char * kFAIL
Definition: AdbClient.cpp:47
static const uint32_t kDefaultMode
Definition: AdbClient.cpp:59
static const size_t kMaxPushData
Definition: AdbClient.cpp:57
static const char * kDONE
Definition: AdbClient.cpp:49
static llvm::raw_ostream & error(Stream &strm)
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
Definition: Statistics.cpp:39
A communication connection class.
Definition: Connection.h:41
virtual size_t Read(void *dst, size_t dst_len, const Timeout< std::micro > &timeout, lldb::ConnectionStatus &status, Status *error_ptr)=0
The read function that attempts to read from the connection.
An binary data encoding class.
Definition: DataEncoder.h:42
llvm::ArrayRef< uint8_t > GetData() const
Get a access to the bytes that this references.
Definition: DataEncoder.cpp:40
void AppendU32(uint32_t value)
void AppendData(llvm::StringRef data)
Append a bytes to the end of the owned data.
An data extractor class.
Definition: DataExtractor.h:48
const void * GetData(lldb::offset_t *offset_ptr, lldb::offset_t length) const
Extract length bytes from *offset_ptr.
uint32_t GetU32(lldb::offset_t *offset_ptr) const
Extract a uint32_t value from *offset_ptr.
A file utility class.
Definition: FileSpec.h:56
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:367
static FileSystem & Instance()
An error handling class.
Definition: Status.h:44
llvm::StringRef GetString() const
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:134
Status internalPushFile(const FileSpec &local_file, const FileSpec &remote_file)
Definition: AdbClient.cpp:459
Status ReadAllBytes(void *buffer, size_t size)
Definition: AdbClient.cpp:646
Status SendSyncRequest(const char *request_id, const uint32_t data_len, const void *data)
Definition: AdbClient.cpp:584
Status executeCommand(const std::function< Status()> &cmd)
Definition: AdbClient.cpp:571
Status PushFile(const FileSpec &local_file, const FileSpec &remote_file)
Definition: AdbClient.cpp:549
SyncService(std::unique_ptr< Connection > &&conn)
Definition: AdbClient.cpp:567
Status PullFileChunk(std::vector< char > &buffer, bool &eof)
Definition: AdbClient.cpp:617
Status ReadSyncHeader(std::string &response_id, uint32_t &data_len)
Definition: AdbClient.cpp:602
virtual Status PullFile(const FileSpec &remote_file, const FileSpec &local_file)
Definition: AdbClient.cpp:542
Status internalPullFile(const FileSpec &remote_file, const FileSpec &local_file)
Definition: AdbClient.cpp:426
virtual Status Stat(const FileSpec &remote_file, uint32_t &mode, uint32_t &size, uint32_t &mtime)
Definition: AdbClient.cpp:556
Status internalStat(const FileSpec &remote_file, uint32_t &mode, uint32_t &size, uint32_t &mtime)
Definition: AdbClient.cpp:508
const std::string & GetDeviceID() const
Definition: AdbClient.cpp:127
void SetDeviceID(const std::string &device_id)
Definition: AdbClient.cpp:123
std::list< std::string > DeviceIDList
Definition: AdbClient.h:33
Status internalShell(const char *command, std::chrono::milliseconds timeout, std::vector< char > &output_buf)
Definition: AdbClient.cpp:349
virtual std::unique_ptr< SyncService > GetSyncService(Status &error)
Definition: AdbClient.cpp:417
Status DeletePortForwarding(const uint16_t local_port)
Definition: AdbClient.cpp:201
static Status CreateByDeviceID(const std::string &device_id, AdbClient &adb)
Definition: AdbClient.cpp:91
Status Shell(const char *command, std::chrono::milliseconds timeout, std::string *output)
Definition: AdbClient.cpp:384
Status ReadAllBytes(void *buffer, size_t size)
Definition: AdbClient.cpp:345
Status SetPortForwarding(const uint16_t local_port, const uint16_t remote_port)
Definition: AdbClient.cpp:169
Status SendDeviceMessage(const std::string &packet)
Definition: AdbClient.cpp:234
virtual Status ShellToFile(const char *command, std::chrono::milliseconds timeout, const FileSpec &output_file_spec)
Definition: AdbClient.cpp:396
Status GetResponseError(const char *response_id)
Definition: AdbClient.cpp:300
Status SendMessage(const std::string &packet, const bool reconnect=true)
Definition: AdbClient.cpp:212
Status ReadMessage(std::vector< char > &message)
Definition: AdbClient.cpp:240
Status GetDevices(DeviceIDList &device_list)
Definition: AdbClient.cpp:142
std::unique_ptr< Connection > m_conn
Definition: AdbClient.h:137
Status ReadMessageStream(std::vector< char > &message, std::chrono::milliseconds timeout)
Definition: AdbClient.cpp:261
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
ConnectionStatus
Connection Status Types.
@ eConnectionStatusSuccess
Success.
uint64_t offset_t
Definition: lldb-types.h:85
@ eByteOrderLittle
#define PATH_MAX