LLDB  mainline
GDBRemoteCommunicationServerCommon.cpp
Go to the documentation of this file.
1 //===-- GDBRemoteCommunicationServerCommon.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 
10 
11 #include <cerrno>
12 
13 #ifdef __APPLE__
14 #include <TargetConditionals.h>
15 #endif
16 
17 #include <chrono>
18 #include <cstring>
19 
20 #include "lldb/Core/ModuleSpec.h"
21 #include "lldb/Host/Config.h"
22 #include "lldb/Host/File.h"
23 #include "lldb/Host/FileAction.h"
24 #include "lldb/Host/FileSystem.h"
25 #include "lldb/Host/Host.h"
26 #include "lldb/Host/HostInfo.h"
27 #include "lldb/Host/SafeMachO.h"
29 #include "lldb/Symbol/ObjectFile.h"
30 #include "lldb/Target/Platform.h"
31 #include "lldb/Utility/Endian.h"
32 #include "lldb/Utility/GDBRemote.h"
33 #include "lldb/Utility/LLDBLog.h"
34 #include "lldb/Utility/Log.h"
37 #include "llvm/ADT/StringSwitch.h"
38 #include "llvm/ADT/Triple.h"
39 #include "llvm/Support/JSON.h"
40 
41 #include "ProcessGDBRemoteLog.h"
43 
44 #ifdef __ANDROID__
46 #endif
47 
48 
49 using namespace lldb;
50 using namespace lldb_private::process_gdb_remote;
51 using namespace lldb_private;
52 
53 #ifdef __ANDROID__
54 const static uint32_t g_default_packet_timeout_sec = 20; // seconds
55 #else
56 const static uint32_t g_default_packet_timeout_sec = 0; // not specified
57 #endif
58 
59 // GDBRemoteCommunicationServerCommon constructor
60 GDBRemoteCommunicationServerCommon::GDBRemoteCommunicationServerCommon(
61  const char *comm_name, const char *listener_name)
62  : GDBRemoteCommunicationServer(comm_name, listener_name),
63  m_process_launch_info(), m_process_launch_error(), m_proc_infos(),
64  m_proc_infos_index(0) {
172 }
173 
174 // Destructor
176  default;
177 
180  StringExtractorGDBRemote &packet) {
181  StreamString response;
182 
183  // $cputype:16777223;cpusubtype:3;ostype:Darwin;vendor:apple;endian:little;ptrsize:8;#00
184 
185  ArchSpec host_arch(HostInfo::GetArchitecture());
186  const llvm::Triple &host_triple = host_arch.GetTriple();
187  response.PutCString("triple:");
188  response.PutStringAsRawHex8(host_triple.getTriple());
189  response.Printf(";ptrsize:%u;", host_arch.GetAddressByteSize());
190 
191  const char *distribution_id = host_arch.GetDistributionId().AsCString();
192  if (distribution_id) {
193  response.PutCString("distribution_id:");
194  response.PutStringAsRawHex8(distribution_id);
195  response.PutCString(";");
196  }
197 
198 #if defined(__APPLE__)
199  // For parity with debugserver, we'll include the vendor key.
200  response.PutCString("vendor:apple;");
201 
202  // Send out MachO info.
203  uint32_t cpu = host_arch.GetMachOCPUType();
204  uint32_t sub = host_arch.GetMachOCPUSubType();
205  if (cpu != LLDB_INVALID_CPUTYPE)
206  response.Printf("cputype:%u;", cpu);
207  if (sub != LLDB_INVALID_CPUTYPE)
208  response.Printf("cpusubtype:%u;", sub);
209 
210  if (cpu == llvm::MachO::CPU_TYPE_ARM || cpu == llvm::MachO::CPU_TYPE_ARM64) {
211 // Indicate the OS type.
212 #if defined(TARGET_OS_TV) && TARGET_OS_TV == 1
213  response.PutCString("ostype:tvos;");
214 #elif defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1
215  response.PutCString("ostype:watchos;");
216 #elif defined(TARGET_OS_BRIDGE) && TARGET_OS_BRIDGE == 1
217  response.PutCString("ostype:bridgeos;");
218 #else
219  response.PutCString("ostype:ios;");
220 #endif
221 
222  // On arm, we use "synchronous" watchpoints which means the exception is
223  // delivered before the instruction executes.
224  response.PutCString("watchpoint_exceptions_received:before;");
225  } else {
226  response.PutCString("ostype:macosx;");
227  response.Printf("watchpoint_exceptions_received:after;");
228  }
229 
230 #else
231  if (host_arch.GetMachine() == llvm::Triple::aarch64 ||
232  host_arch.GetMachine() == llvm::Triple::aarch64_32 ||
233  host_arch.GetMachine() == llvm::Triple::aarch64_be ||
234  host_arch.GetMachine() == llvm::Triple::arm ||
235  host_arch.GetMachine() == llvm::Triple::armeb || host_arch.IsMIPS())
236  response.Printf("watchpoint_exceptions_received:before;");
237  else
238  response.Printf("watchpoint_exceptions_received:after;");
239 #endif
240 
241  switch (endian::InlHostByteOrder()) {
242  case eByteOrderBig:
243  response.PutCString("endian:big;");
244  break;
245  case eByteOrderLittle:
246  response.PutCString("endian:little;");
247  break;
248  case eByteOrderPDP:
249  response.PutCString("endian:pdp;");
250  break;
251  default:
252  response.PutCString("endian:unknown;");
253  break;
254  }
255 
256  llvm::VersionTuple version = HostInfo::GetOSVersion();
257  if (!version.empty()) {
258  response.Format("os_version:{0}", version.getAsString());
259  response.PutChar(';');
260  }
261 
262 #if defined(__APPLE__)
263  llvm::VersionTuple maccatalyst_version = HostInfo::GetMacCatalystVersion();
264  if (!maccatalyst_version.empty()) {
265  response.Format("maccatalyst_version:{0}",
266  maccatalyst_version.getAsString());
267  response.PutChar(';');
268  }
269 #endif
270 
271  if (llvm::Optional<std::string> s = HostInfo::GetOSBuildString()) {
272  response.PutCString("os_build:");
273  response.PutStringAsRawHex8(*s);
274  response.PutChar(';');
275  }
276  if (llvm::Optional<std::string> s = HostInfo::GetOSKernelDescription()) {
277  response.PutCString("os_kernel:");
278  response.PutStringAsRawHex8(*s);
279  response.PutChar(';');
280  }
281 
282  std::string s;
283 #if defined(__APPLE__)
284 
285 #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
286  // For iOS devices, we are connected through a USB Mux so we never pretend to
287  // actually have a hostname as far as the remote lldb that is connecting to
288  // this lldb-platform is concerned
289  response.PutCString("hostname:");
290  response.PutStringAsRawHex8("127.0.0.1");
291  response.PutChar(';');
292 #else // #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
293  if (HostInfo::GetHostname(s)) {
294  response.PutCString("hostname:");
295  response.PutStringAsRawHex8(s);
296  response.PutChar(';');
297  }
298 #endif // #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
299 
300 #else // #if defined(__APPLE__)
301  if (HostInfo::GetHostname(s)) {
302  response.PutCString("hostname:");
303  response.PutStringAsRawHex8(s);
304  response.PutChar(';');
305  }
306 #endif // #if defined(__APPLE__)
307 
309  response.Printf("default_packet_timeout:%u;", g_default_packet_timeout_sec);
310 
311  return SendPacketNoLock(response.GetString());
312 }
313 
316  StringExtractorGDBRemote &packet) {
317  // Packet format: "qProcessInfoPID:%i" where %i is the pid
318  packet.SetFilePos(::strlen("qProcessInfoPID:"));
320  if (pid != LLDB_INVALID_PROCESS_ID) {
321  ProcessInstanceInfo proc_info;
322  if (Host::GetProcessInfo(pid, proc_info)) {
323  StreamString response;
324  CreateProcessInfoResponse(proc_info, response);
325  return SendPacketNoLock(response.GetString());
326  }
327  }
328  return SendErrorResponse(1);
329 }
330 
333  StringExtractorGDBRemote &packet) {
334  m_proc_infos_index = 0;
335  m_proc_infos.clear();
336 
337  ProcessInstanceInfoMatch match_info;
338  packet.SetFilePos(::strlen("qfProcessInfo"));
339  if (packet.GetChar() == ':') {
340  llvm::StringRef key;
341  llvm::StringRef value;
342  while (packet.GetNameColonValue(key, value)) {
343  bool success = true;
344  if (key.equals("name")) {
345  StringExtractor extractor(value);
346  std::string file;
347  extractor.GetHexByteString(file);
349  file, FileSpec::Style::native);
350  } else if (key.equals("name_match")) {
351  NameMatch name_match = llvm::StringSwitch<NameMatch>(value)
352  .Case("equals", NameMatch::Equals)
353  .Case("starts_with", NameMatch::StartsWith)
354  .Case("ends_with", NameMatch::EndsWith)
355  .Case("contains", NameMatch::Contains)
356  .Case("regex", NameMatch::RegularExpression)
357  .Default(NameMatch::Ignore);
358  match_info.SetNameMatchType(name_match);
359  if (name_match == NameMatch::Ignore)
360  return SendErrorResponse(2);
361  } else if (key.equals("pid")) {
363  if (value.getAsInteger(0, pid))
364  return SendErrorResponse(2);
365  match_info.GetProcessInfo().SetProcessID(pid);
366  } else if (key.equals("parent_pid")) {
368  if (value.getAsInteger(0, pid))
369  return SendErrorResponse(2);
370  match_info.GetProcessInfo().SetParentProcessID(pid);
371  } else if (key.equals("uid")) {
372  uint32_t uid = UINT32_MAX;
373  if (value.getAsInteger(0, uid))
374  return SendErrorResponse(2);
375  match_info.GetProcessInfo().SetUserID(uid);
376  } else if (key.equals("gid")) {
377  uint32_t gid = UINT32_MAX;
378  if (value.getAsInteger(0, gid))
379  return SendErrorResponse(2);
380  match_info.GetProcessInfo().SetGroupID(gid);
381  } else if (key.equals("euid")) {
382  uint32_t uid = UINT32_MAX;
383  if (value.getAsInteger(0, uid))
384  return SendErrorResponse(2);
385  match_info.GetProcessInfo().SetEffectiveUserID(uid);
386  } else if (key.equals("egid")) {
387  uint32_t gid = UINT32_MAX;
388  if (value.getAsInteger(0, gid))
389  return SendErrorResponse(2);
390  match_info.GetProcessInfo().SetEffectiveGroupID(gid);
391  } else if (key.equals("all_users")) {
392  match_info.SetMatchAllUsers(
393  OptionArgParser::ToBoolean(value, false, &success));
394  } else if (key.equals("triple")) {
395  match_info.GetProcessInfo().GetArchitecture() =
396  HostInfo::GetAugmentedArchSpec(value);
397  } else {
398  success = false;
399  }
400 
401  if (!success)
402  return SendErrorResponse(2);
403  }
404  }
405 
406  if (Host::FindProcesses(match_info, m_proc_infos)) {
407  // We found something, return the first item by calling the get subsequent
408  // process info packet handler...
409  return Handle_qsProcessInfo(packet);
410  }
411  return SendErrorResponse(3);
412 }
413 
416  StringExtractorGDBRemote &packet) {
417  if (m_proc_infos_index < m_proc_infos.size()) {
418  StreamString response;
421  return SendPacketNoLock(response.GetString());
422  }
423  return SendErrorResponse(4);
424 }
425 
428  StringExtractorGDBRemote &packet) {
429 #if LLDB_ENABLE_POSIX
430  Log *log = GetLog(LLDBLog::Process);
431  LLDB_LOGF(log, "GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__);
432 
433  // Packet format: "qUserName:%i" where %i is the uid
434  packet.SetFilePos(::strlen("qUserName:"));
435  uint32_t uid = packet.GetU32(UINT32_MAX);
436  if (uid != UINT32_MAX) {
437  if (llvm::Optional<llvm::StringRef> name =
438  HostInfo::GetUserIDResolver().GetUserName(uid)) {
439  StreamString response;
440  response.PutStringAsRawHex8(*name);
441  return SendPacketNoLock(response.GetString());
442  }
443  }
444  LLDB_LOGF(log, "GDBRemoteCommunicationServerCommon::%s end", __FUNCTION__);
445 #endif
446  return SendErrorResponse(5);
447 }
448 
451  StringExtractorGDBRemote &packet) {
452 #if LLDB_ENABLE_POSIX
453  // Packet format: "qGroupName:%i" where %i is the gid
454  packet.SetFilePos(::strlen("qGroupName:"));
455  uint32_t gid = packet.GetU32(UINT32_MAX);
456  if (gid != UINT32_MAX) {
457  if (llvm::Optional<llvm::StringRef> name =
458  HostInfo::GetUserIDResolver().GetGroupName(gid)) {
459  StreamString response;
460  response.PutStringAsRawHex8(*name);
461  return SendPacketNoLock(response.GetString());
462  }
463  }
464 #endif
465  return SendErrorResponse(6);
466 }
467 
470  StringExtractorGDBRemote &packet) {
471  packet.SetFilePos(::strlen("qSpeedTest:"));
472 
473  llvm::StringRef key;
474  llvm::StringRef value;
475  bool success = packet.GetNameColonValue(key, value);
476  if (success && key.equals("response_size")) {
477  uint32_t response_size = 0;
478  if (!value.getAsInteger(0, response_size)) {
479  if (response_size == 0)
480  return SendOKResponse();
481  StreamString response;
482  uint32_t bytes_left = response_size;
483  response.PutCString("data:");
484  while (bytes_left > 0) {
485  if (bytes_left >= 26) {
486  response.PutCString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
487  bytes_left -= 26;
488  } else {
489  response.Printf("%*.*s;", bytes_left, bytes_left,
490  "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
491  bytes_left = 0;
492  }
493  }
494  return SendPacketNoLock(response.GetString());
495  }
496  }
497  return SendErrorResponse(7);
498 }
499 
502  StringExtractorGDBRemote &packet) {
503  packet.SetFilePos(::strlen("vFile:open:"));
504  std::string path;
505  packet.GetHexByteStringTerminatedBy(path, ',');
506  if (!path.empty()) {
507  if (packet.GetChar() == ',') {
508  auto flags = File::OpenOptions(packet.GetHexMaxU32(false, 0));
509  if (packet.GetChar() == ',') {
510  mode_t mode = packet.GetHexMaxU32(false, 0600);
511  FileSpec path_spec(path);
512  FileSystem::Instance().Resolve(path_spec);
513  // Do not close fd.
514  auto file = FileSystem::Instance().Open(path_spec, flags, mode, false);
515 
516  StreamString response;
517  response.PutChar('F');
518 
519  int descriptor = File::kInvalidDescriptor;
520  if (file) {
521  descriptor = file.get()->GetDescriptor();
522  response.Printf("%x", descriptor);
523  } else {
524  response.PutCString("-1");
525  std::error_code code = errorToErrorCode(file.takeError());
526  if (code.category() == std::system_category()) {
527  response.Printf(",%x", code.value());
528  }
529  }
530 
531  return SendPacketNoLock(response.GetString());
532  }
533  }
534  }
535  return SendErrorResponse(18);
536 }
537 
538 static GDBErrno system_errno_to_gdb(int err) {
539  switch (err) {
540 #define HANDLE_ERRNO(name, value) \
541  case name: \
542  return GDB_##name;
543 #include "Plugins/Process/gdb-remote/GDBRemoteErrno.def"
544  default:
545  return GDB_EUNKNOWN;
546  }
547 }
548 
551  StringExtractorGDBRemote &packet) {
552  packet.SetFilePos(::strlen("vFile:close:"));
553  int fd = packet.GetS32(-1, 16);
554  int err = -1;
555  int save_errno = 0;
556  if (fd >= 0) {
557  NativeFile file(fd, File::OpenOptions(0), true);
558  Status error = file.Close();
559  err = 0;
560  save_errno = error.GetError();
561  } else {
562  save_errno = EINVAL;
563  }
564  StreamString response;
565  response.PutChar('F');
566  response.Printf("%x", err);
567  if (save_errno)
568  response.Printf(",%x", system_errno_to_gdb(save_errno));
569  return SendPacketNoLock(response.GetString());
570 }
571 
574  StringExtractorGDBRemote &packet) {
575  StreamGDBRemote response;
576  packet.SetFilePos(::strlen("vFile:pread:"));
577  int fd = packet.GetS32(-1, 16);
578  if (packet.GetChar() == ',') {
579  size_t count = packet.GetHexMaxU64(false, SIZE_MAX);
580  if (packet.GetChar() == ',') {
581  off_t offset = packet.GetHexMaxU32(false, UINT32_MAX);
582  if (count == SIZE_MAX) {
583  response.Printf("F-1:%x", EINVAL);
584  return SendPacketNoLock(response.GetString());
585  }
586 
587  std::string buffer(count, 0);
588  NativeFile file(fd, File::eOpenOptionReadOnly, false);
589  Status error = file.Read(static_cast<void *>(&buffer[0]), count, offset);
590  const int save_errno = error.GetError();
591  response.PutChar('F');
592  if (error.Success()) {
593  response.Printf("%zx", count);
594  response.PutChar(';');
595  response.PutEscapedBytes(&buffer[0], count);
596  } else {
597  response.PutCString("-1");
598  if (save_errno)
599  response.Printf(",%x", system_errno_to_gdb(save_errno));
600  }
601  return SendPacketNoLock(response.GetString());
602  }
603  }
604  return SendErrorResponse(21);
605 }
606 
609  StringExtractorGDBRemote &packet) {
610  packet.SetFilePos(::strlen("vFile:pwrite:"));
611 
612  StreamGDBRemote response;
613  response.PutChar('F');
614 
615  int fd = packet.GetS32(-1, 16);
616  if (packet.GetChar() == ',') {
617  off_t offset = packet.GetHexMaxU32(false, UINT32_MAX);
618  if (packet.GetChar() == ',') {
619  std::string buffer;
620  if (packet.GetEscapedBinaryData(buffer)) {
621  NativeFile file(fd, File::eOpenOptionWriteOnly, false);
622  size_t count = buffer.size();
623  Status error =
624  file.Write(static_cast<const void *>(&buffer[0]), count, offset);
625  const int save_errno = error.GetError();
626  if (error.Success())
627  response.Printf("%zx", count);
628  else {
629  response.PutCString("-1");
630  if (save_errno)
631  response.Printf(",%x", system_errno_to_gdb(save_errno));
632  }
633  } else {
634  response.Printf("-1,%x", EINVAL);
635  }
636  return SendPacketNoLock(response.GetString());
637  }
638  }
639  return SendErrorResponse(27);
640 }
641 
644  StringExtractorGDBRemote &packet) {
645  packet.SetFilePos(::strlen("vFile:size:"));
646  std::string path;
647  packet.GetHexByteString(path);
648  if (!path.empty()) {
649  uint64_t Size;
650  if (llvm::sys::fs::file_size(path, Size))
651  return SendErrorResponse(5);
652  StreamString response;
653  response.PutChar('F');
654  response.PutHex64(Size);
655  if (Size == UINT64_MAX) {
656  response.PutChar(',');
657  response.PutHex64(Size); // TODO: replace with Host::GetSyswideErrorCode()
658  }
659  return SendPacketNoLock(response.GetString());
660  }
661  return SendErrorResponse(22);
662 }
663 
666  StringExtractorGDBRemote &packet) {
667  packet.SetFilePos(::strlen("vFile:mode:"));
668  std::string path;
669  packet.GetHexByteString(path);
670  if (!path.empty()) {
671  FileSpec file_spec(path);
672  FileSystem::Instance().Resolve(file_spec);
673  std::error_code ec;
674  const uint32_t mode = FileSystem::Instance().GetPermissions(file_spec, ec);
675  StreamString response;
676  if (mode != llvm::sys::fs::perms_not_known)
677  response.Printf("F%x", mode);
678  else
679  response.Printf("F-1,%x", (int)Status(ec).GetError());
680  return SendPacketNoLock(response.GetString());
681  }
682  return SendErrorResponse(23);
683 }
684 
687  StringExtractorGDBRemote &packet) {
688  packet.SetFilePos(::strlen("vFile:exists:"));
689  std::string path;
690  packet.GetHexByteString(path);
691  if (!path.empty()) {
692  bool retcode = llvm::sys::fs::exists(path);
693  StreamString response;
694  response.PutChar('F');
695  response.PutChar(',');
696  if (retcode)
697  response.PutChar('1');
698  else
699  response.PutChar('0');
700  return SendPacketNoLock(response.GetString());
701  }
702  return SendErrorResponse(24);
703 }
704 
707  StringExtractorGDBRemote &packet) {
708  packet.SetFilePos(::strlen("vFile:symlink:"));
709  std::string dst, src;
710  packet.GetHexByteStringTerminatedBy(dst, ',');
711  packet.GetChar(); // Skip ',' char
712  packet.GetHexByteString(src);
713 
714  FileSpec src_spec(src);
715  FileSystem::Instance().Resolve(src_spec);
716  Status error = FileSystem::Instance().Symlink(src_spec, FileSpec(dst));
717 
718  StreamString response;
719  response.Printf("F%x,%x", error.GetError(), error.GetError());
720  return SendPacketNoLock(response.GetString());
721 }
722 
725  StringExtractorGDBRemote &packet) {
726  packet.SetFilePos(::strlen("vFile:unlink:"));
727  std::string path;
728  packet.GetHexByteString(path);
729  Status error(llvm::sys::fs::remove(path));
730  StreamString response;
731  response.Printf("F%x,%x", error.GetError(), error.GetError());
732  return SendPacketNoLock(response.GetString());
733 }
734 
737  StringExtractorGDBRemote &packet) {
738  packet.SetFilePos(::strlen("qPlatform_shell:"));
739  std::string path;
740  std::string working_dir;
741  packet.GetHexByteStringTerminatedBy(path, ',');
742  if (!path.empty()) {
743  if (packet.GetChar() == ',') {
744  // FIXME: add timeout to qPlatform_shell packet
745  // uint32_t timeout = packet.GetHexMaxU32(false, 32);
746  if (packet.GetChar() == ',')
747  packet.GetHexByteString(working_dir);
748  int status, signo;
749  std::string output;
750  FileSpec working_spec(working_dir);
751  FileSystem::Instance().Resolve(working_spec);
752  Status err =
753  Host::RunShellCommand(path.c_str(), working_spec, &status, &signo,
754  &output, std::chrono::seconds(10));
755  StreamGDBRemote response;
756  if (err.Fail()) {
757  response.PutCString("F,");
758  response.PutHex32(UINT32_MAX);
759  } else {
760  response.PutCString("F,");
761  response.PutHex32(status);
762  response.PutChar(',');
763  response.PutHex32(signo);
764  response.PutChar(',');
765  response.PutEscapedBytes(output.c_str(), output.size());
766  }
767  return SendPacketNoLock(response.GetString());
768  }
769  }
770  return SendErrorResponse(24);
771 }
772 
773 template <typename T, typename U>
774 static void fill_clamp(T &dest, U src, typename T::value_type fallback) {
775  static_assert(std::is_unsigned<typename T::value_type>::value,
776  "Destination type must be unsigned.");
777  using UU = typename std::make_unsigned<U>::type;
778  constexpr auto T_max = std::numeric_limits<typename T::value_type>::max();
779  dest = src >= 0 && static_cast<UU>(src) <= T_max ? src : fallback;
780 }
781 
784  StringExtractorGDBRemote &packet) {
785  StreamGDBRemote response;
786  packet.SetFilePos(::strlen("vFile:fstat:"));
787  int fd = packet.GetS32(-1, 16);
788 
789  struct stat file_stats;
790  if (::fstat(fd, &file_stats) == -1) {
791  const int save_errno = errno;
792  response.Printf("F-1,%x", system_errno_to_gdb(save_errno));
793  return SendPacketNoLock(response.GetString());
794  }
795 
796  GDBRemoteFStatData data;
797  fill_clamp(data.gdb_st_dev, file_stats.st_dev, 0);
798  fill_clamp(data.gdb_st_ino, file_stats.st_ino, 0);
799  data.gdb_st_mode = file_stats.st_mode;
800  fill_clamp(data.gdb_st_nlink, file_stats.st_nlink, UINT32_MAX);
801  fill_clamp(data.gdb_st_uid, file_stats.st_uid, 0);
802  fill_clamp(data.gdb_st_gid, file_stats.st_gid, 0);
803  fill_clamp(data.gdb_st_rdev, file_stats.st_rdev, 0);
804  data.gdb_st_size = file_stats.st_size;
805 #if !defined(_WIN32)
806  data.gdb_st_blksize = file_stats.st_blksize;
807  data.gdb_st_blocks = file_stats.st_blocks;
808 #else
809  data.gdb_st_blksize = 0;
810  data.gdb_st_blocks = 0;
811 #endif
812  fill_clamp(data.gdb_st_atime, file_stats.st_atime, 0);
813  fill_clamp(data.gdb_st_mtime, file_stats.st_mtime, 0);
814  fill_clamp(data.gdb_st_ctime, file_stats.st_ctime, 0);
815 
816  response.Printf("F%zx;", sizeof(data));
817  response.PutEscapedBytes(&data, sizeof(data));
818  return SendPacketNoLock(response.GetString());
819 }
820 
823  StringExtractorGDBRemote &packet) {
825  "GDBRemoteCommunicationServerCommon::Handle_vFile_Stat() unimplemented");
826 }
827 
830  StringExtractorGDBRemote &packet) {
831  packet.SetFilePos(::strlen("vFile:MD5:"));
832  std::string path;
833  packet.GetHexByteString(path);
834  if (!path.empty()) {
835  StreamGDBRemote response;
836  auto Result = llvm::sys::fs::md5_contents(path);
837  if (!Result) {
838  response.PutCString("F,");
839  response.PutCString("x");
840  } else {
841  response.PutCString("F,");
842  response.PutHex64(Result->low());
843  response.PutHex64(Result->high());
844  }
845  return SendPacketNoLock(response.GetString());
846  }
847  return SendErrorResponse(25);
848 }
849 
852  StringExtractorGDBRemote &packet) {
853  packet.SetFilePos(::strlen("qPlatform_mkdir:"));
854  mode_t mode = packet.GetHexMaxU32(false, UINT32_MAX);
855  if (packet.GetChar() == ',') {
856  std::string path;
857  packet.GetHexByteString(path);
858  Status error(llvm::sys::fs::create_directory(path, mode));
859 
860  StreamGDBRemote response;
861  response.Printf("F%x", error.GetError());
862 
863  return SendPacketNoLock(response.GetString());
864  }
865  return SendErrorResponse(20);
866 }
867 
870  StringExtractorGDBRemote &packet) {
871  packet.SetFilePos(::strlen("qPlatform_chmod:"));
872 
873  auto perms =
874  static_cast<llvm::sys::fs::perms>(packet.GetHexMaxU32(false, UINT32_MAX));
875  if (packet.GetChar() == ',') {
876  std::string path;
877  packet.GetHexByteString(path);
878  Status error(llvm::sys::fs::setPermissions(path, perms));
879 
880  StreamGDBRemote response;
881  response.Printf("F%x", error.GetError());
882 
883  return SendPacketNoLock(response.GetString());
884  }
885  return SendErrorResponse(19);
886 }
887 
890  StringExtractorGDBRemote &packet) {
891  // Parse client-indicated features.
892  llvm::SmallVector<llvm::StringRef, 4> client_features;
893  packet.GetStringRef().split(client_features, ';');
894  return SendPacketNoLock(llvm::join(HandleFeatures(client_features), ";"));
895 }
896 
899  StringExtractorGDBRemote &packet) {
900  packet.SetFilePos(::strlen("QSetDetachOnError:"));
901  if (packet.GetU32(0))
902  m_process_launch_info.GetFlags().Set(eLaunchFlagDetachOnError);
903  else
904  m_process_launch_info.GetFlags().Clear(eLaunchFlagDetachOnError);
905  return SendOKResponse();
906 }
907 
910  StringExtractorGDBRemote &packet) {
911  // Send response first before changing m_send_acks to we ack this packet
912  PacketResult packet_result = SendOKResponse();
913  m_send_acks = false;
914  return packet_result;
915 }
916 
919  StringExtractorGDBRemote &packet) {
920  packet.SetFilePos(::strlen("QSetSTDIN:"));
921  FileAction file_action;
922  std::string path;
923  packet.GetHexByteString(path);
924  const bool read = true;
925  const bool write = false;
926  if (file_action.Open(STDIN_FILENO, FileSpec(path), read, write)) {
928  return SendOKResponse();
929  }
930  return SendErrorResponse(15);
931 }
932 
935  StringExtractorGDBRemote &packet) {
936  packet.SetFilePos(::strlen("QSetSTDOUT:"));
937  FileAction file_action;
938  std::string path;
939  packet.GetHexByteString(path);
940  const bool read = false;
941  const bool write = true;
942  if (file_action.Open(STDOUT_FILENO, FileSpec(path), read, write)) {
944  return SendOKResponse();
945  }
946  return SendErrorResponse(16);
947 }
948 
951  StringExtractorGDBRemote &packet) {
952  packet.SetFilePos(::strlen("QSetSTDERR:"));
953  FileAction file_action;
954  std::string path;
955  packet.GetHexByteString(path);
956  const bool read = false;
957  const bool write = true;
958  if (file_action.Open(STDERR_FILENO, FileSpec(path), read, write)) {
960  return SendOKResponse();
961  }
962  return SendErrorResponse(17);
963 }
964 
967  StringExtractorGDBRemote &packet) {
969  return SendOKResponse();
970  StreamString response;
971  response.PutChar('E');
972  response.PutCString(m_process_launch_error.AsCString("<unknown error>"));
973  return SendPacketNoLock(response.GetString());
974 }
975 
978  StringExtractorGDBRemote &packet) {
979  packet.SetFilePos(::strlen("QEnvironment:"));
980  const uint32_t bytes_left = packet.GetBytesLeft();
981  if (bytes_left > 0) {
983  return SendOKResponse();
984  }
985  return SendErrorResponse(12);
986 }
987 
990  StringExtractorGDBRemote &packet) {
991  packet.SetFilePos(::strlen("QEnvironmentHexEncoded:"));
992  const uint32_t bytes_left = packet.GetBytesLeft();
993  if (bytes_left > 0) {
994  std::string str;
995  packet.GetHexByteString(str);
997  return SendOKResponse();
998  }
999  return SendErrorResponse(12);
1000 }
1001 
1004  StringExtractorGDBRemote &packet) {
1005  packet.SetFilePos(::strlen("QLaunchArch:"));
1006  const uint32_t bytes_left = packet.GetBytesLeft();
1007  if (bytes_left > 0) {
1008  const char *arch_triple = packet.Peek();
1010  HostInfo::GetAugmentedArchSpec(arch_triple));
1011  return SendOKResponse();
1012  }
1013  return SendErrorResponse(13);
1014 }
1015 
1018  // The 'A' packet is the most over designed packet ever here with redundant
1019  // argument indexes, redundant argument lengths and needed hex encoded
1020  // argument string values. Really all that is needed is a comma separated hex
1021  // encoded argument value list, but we will stay true to the documented
1022  // version of the 'A' packet here...
1023 
1024  Log *log = GetLog(LLDBLog::Process);
1025  int actual_arg_index = 0;
1026 
1027  packet.SetFilePos(1); // Skip the 'A'
1028  bool success = true;
1029  while (success && packet.GetBytesLeft() > 0) {
1030  // Decode the decimal argument string length. This length is the number of
1031  // hex nibbles in the argument string value.
1032  const uint32_t arg_len = packet.GetU32(UINT32_MAX);
1033  if (arg_len == UINT32_MAX)
1034  success = false;
1035  else {
1036  // Make sure the argument hex string length is followed by a comma
1037  if (packet.GetChar() != ',')
1038  success = false;
1039  else {
1040  // Decode the argument index. We ignore this really because who would
1041  // really send down the arguments in a random order???
1042  const uint32_t arg_idx = packet.GetU32(UINT32_MAX);
1043  if (arg_idx == UINT32_MAX)
1044  success = false;
1045  else {
1046  // Make sure the argument index is followed by a comma
1047  if (packet.GetChar() != ',')
1048  success = false;
1049  else {
1050  // Decode the argument string value from hex bytes back into a UTF8
1051  // string and make sure the length matches the one supplied in the
1052  // packet
1053  std::string arg;
1054  if (packet.GetHexByteStringFixedLength(arg, arg_len) !=
1055  (arg_len / 2))
1056  success = false;
1057  else {
1058  // If there are any bytes left
1059  if (packet.GetBytesLeft()) {
1060  if (packet.GetChar() != ',')
1061  success = false;
1062  }
1063 
1064  if (success) {
1065  if (arg_idx == 0)
1067  arg, FileSpec::Style::native);
1069  LLDB_LOGF(log, "LLGSPacketHandler::%s added arg %d: \"%s\"",
1070  __FUNCTION__, actual_arg_index, arg.c_str());
1071  ++actual_arg_index;
1072  }
1073  }
1074  }
1075  }
1076  }
1077  }
1078  }
1079 
1080  if (success) {
1083  return SendOKResponse();
1084  LLDB_LOG(log, "failed to launch exe: {0}", m_process_launch_error);
1085  }
1086  return SendErrorResponse(8);
1087 }
1088 
1091  StringExtractorGDBRemote &packet) {
1092  // Just echo back the exact same packet for qEcho...
1093  return SendPacketNoLock(packet.GetStringRef());
1094 }
1095 
1098  StringExtractorGDBRemote &packet) {
1099  packet.SetFilePos(::strlen("qModuleInfo:"));
1100 
1101  std::string module_path;
1102  packet.GetHexByteStringTerminatedBy(module_path, ';');
1103  if (module_path.empty())
1104  return SendErrorResponse(1);
1105 
1106  if (packet.GetChar() != ';')
1107  return SendErrorResponse(2);
1108 
1109  std::string triple;
1110  packet.GetHexByteString(triple);
1111 
1112  ModuleSpec matched_module_spec = GetModuleInfo(module_path, triple);
1113  if (!matched_module_spec.GetFileSpec())
1114  return SendErrorResponse(3);
1115 
1116  const auto file_offset = matched_module_spec.GetObjectOffset();
1117  const auto file_size = matched_module_spec.GetObjectSize();
1118  const auto uuid_str = matched_module_spec.GetUUID().GetAsString("");
1119 
1120  StreamGDBRemote response;
1121 
1122  if (uuid_str.empty()) {
1123  auto Result = llvm::sys::fs::md5_contents(
1124  matched_module_spec.GetFileSpec().GetPath());
1125  if (!Result)
1126  return SendErrorResponse(5);
1127  response.PutCString("md5:");
1128  response.PutStringAsRawHex8(Result->digest());
1129  } else {
1130  response.PutCString("uuid:");
1131  response.PutStringAsRawHex8(uuid_str);
1132  }
1133  response.PutChar(';');
1134 
1135  const auto &module_arch = matched_module_spec.GetArchitecture();
1136  response.PutCString("triple:");
1137  response.PutStringAsRawHex8(module_arch.GetTriple().getTriple());
1138  response.PutChar(';');
1139 
1140  response.PutCString("file_path:");
1141  response.PutStringAsRawHex8(matched_module_spec.GetFileSpec().GetCString());
1142  response.PutChar(';');
1143  response.PutCString("file_offset:");
1144  response.PutHex64(file_offset);
1145  response.PutChar(';');
1146  response.PutCString("file_size:");
1147  response.PutHex64(file_size);
1148  response.PutChar(';');
1149 
1150  return SendPacketNoLock(response.GetString());
1151 }
1152 
1155  StringExtractorGDBRemote &packet) {
1156  namespace json = llvm::json;
1157 
1158  packet.SetFilePos(::strlen("jModulesInfo:"));
1159 
1161  if (!object_sp)
1162  return SendErrorResponse(1);
1163 
1164  StructuredData::Array *packet_array = object_sp->GetAsArray();
1165  if (!packet_array)
1166  return SendErrorResponse(2);
1167 
1168  json::Array response_array;
1169  for (size_t i = 0; i < packet_array->GetSize(); ++i) {
1171  packet_array->GetItemAtIndex(i)->GetAsDictionary();
1172  if (!query)
1173  continue;
1174  llvm::StringRef file, triple;
1175  if (!query->GetValueForKeyAsString("file", file) ||
1176  !query->GetValueForKeyAsString("triple", triple))
1177  continue;
1178 
1179  ModuleSpec matched_module_spec = GetModuleInfo(file, triple);
1180  if (!matched_module_spec.GetFileSpec())
1181  continue;
1182 
1183  const auto file_offset = matched_module_spec.GetObjectOffset();
1184  const auto file_size = matched_module_spec.GetObjectSize();
1185  const auto uuid_str = matched_module_spec.GetUUID().GetAsString("");
1186  if (uuid_str.empty())
1187  continue;
1188  const auto triple_str =
1189  matched_module_spec.GetArchitecture().GetTriple().getTriple();
1190  const auto file_path = matched_module_spec.GetFileSpec().GetPath();
1191 
1192  json::Object response{{"uuid", uuid_str},
1193  {"triple", triple_str},
1194  {"file_path", file_path},
1195  {"file_offset", static_cast<int64_t>(file_offset)},
1196  {"file_size", static_cast<int64_t>(file_size)}};
1197  response_array.push_back(std::move(response));
1198  }
1199 
1200  StreamString response;
1201  response.AsRawOstream() << std::move(response_array);
1202  StreamGDBRemote escaped_response;
1203  escaped_response.PutEscapedBytes(response.GetString().data(),
1204  response.GetSize());
1205  return SendPacketNoLock(escaped_response.GetString());
1206 }
1207 
1209  const ProcessInstanceInfo &proc_info, StreamString &response) {
1210  response.Printf(
1211  "pid:%" PRIu64 ";ppid:%" PRIu64 ";uid:%i;gid:%i;euid:%i;egid:%i;",
1212  proc_info.GetProcessID(), proc_info.GetParentProcessID(),
1213  proc_info.GetUserID(), proc_info.GetGroupID(),
1214  proc_info.GetEffectiveUserID(), proc_info.GetEffectiveGroupID());
1215  response.PutCString("name:");
1216  response.PutStringAsRawHex8(proc_info.GetExecutableFile().GetCString());
1217 
1218  response.PutChar(';');
1219  response.PutCString("args:");
1220  response.PutStringAsRawHex8(proc_info.GetArg0());
1221  for (auto &arg : proc_info.GetArguments()) {
1222  response.PutChar('-');
1223  response.PutStringAsRawHex8(arg.ref());
1224  }
1225 
1226  response.PutChar(';');
1227  const ArchSpec &proc_arch = proc_info.GetArchitecture();
1228  if (proc_arch.IsValid()) {
1229  const llvm::Triple &proc_triple = proc_arch.GetTriple();
1230  response.PutCString("triple:");
1231  response.PutStringAsRawHex8(proc_triple.getTriple());
1232  response.PutChar(';');
1233  }
1234 }
1235 
1238  const ProcessInstanceInfo &proc_info, StreamString &response) {
1239  response.Printf("pid:%" PRIx64 ";parent-pid:%" PRIx64
1240  ";real-uid:%x;real-gid:%x;effective-uid:%x;effective-gid:%x;",
1241  proc_info.GetProcessID(), proc_info.GetParentProcessID(),
1242  proc_info.GetUserID(), proc_info.GetGroupID(),
1243  proc_info.GetEffectiveUserID(),
1244  proc_info.GetEffectiveGroupID());
1245 
1246  const ArchSpec &proc_arch = proc_info.GetArchitecture();
1247  if (proc_arch.IsValid()) {
1248  const llvm::Triple &proc_triple = proc_arch.GetTriple();
1249 #if defined(__APPLE__)
1250  // We'll send cputype/cpusubtype.
1251  const uint32_t cpu_type = proc_arch.GetMachOCPUType();
1252  if (cpu_type != 0)
1253  response.Printf("cputype:%" PRIx32 ";", cpu_type);
1254 
1255  const uint32_t cpu_subtype = proc_arch.GetMachOCPUSubType();
1256  if (cpu_subtype != 0)
1257  response.Printf("cpusubtype:%" PRIx32 ";", cpu_subtype);
1258 
1259  const std::string vendor = proc_triple.getVendorName().str();
1260  if (!vendor.empty())
1261  response.Printf("vendor:%s;", vendor.c_str());
1262 #else
1263  // We'll send the triple.
1264  response.PutCString("triple:");
1265  response.PutStringAsRawHex8(proc_triple.getTriple());
1266  response.PutChar(';');
1267 #endif
1268  std::string ostype = std::string(proc_triple.getOSName());
1269  // Adjust so ostype reports ios for Apple/ARM and Apple/ARM64.
1270  if (proc_triple.getVendor() == llvm::Triple::Apple) {
1271  switch (proc_triple.getArch()) {
1272  case llvm::Triple::arm:
1273  case llvm::Triple::thumb:
1274  case llvm::Triple::aarch64:
1275  case llvm::Triple::aarch64_32:
1276  ostype = "ios";
1277  break;
1278  default:
1279  // No change.
1280  break;
1281  }
1282  }
1283  response.Printf("ostype:%s;", ostype.c_str());
1284 
1285  switch (proc_arch.GetByteOrder()) {
1287  response.PutCString("endian:little;");
1288  break;
1289  case lldb::eByteOrderBig:
1290  response.PutCString("endian:big;");
1291  break;
1292  case lldb::eByteOrderPDP:
1293  response.PutCString("endian:pdp;");
1294  break;
1295  default:
1296  // Nothing.
1297  break;
1298  }
1299  // In case of MIPS64, pointer size is depend on ELF ABI For N32 the pointer
1300  // size is 4 and for N64 it is 8
1301  std::string abi = proc_arch.GetTargetABI();
1302  if (!abi.empty())
1303  response.Printf("elf_abi:%s;", abi.c_str());
1304  response.Printf("ptrsize:%d;", proc_arch.GetAddressByteSize());
1305  }
1306 }
1307 
1309  const std::string &module_path, const ArchSpec &arch) {
1310 #ifdef __ANDROID__
1311  return HostInfoAndroid::ResolveLibraryPath(module_path, arch);
1312 #else
1313  FileSpec file_spec(module_path);
1314  FileSystem::Instance().Resolve(file_spec);
1315  return file_spec;
1316 #endif
1317 }
1318 
1319 ModuleSpec
1321  llvm::StringRef triple) {
1322  ArchSpec arch(triple);
1323 
1324  FileSpec req_module_path_spec(module_path);
1325  FileSystem::Instance().Resolve(req_module_path_spec);
1326 
1327  const FileSpec module_path_spec =
1328  FindModuleFile(req_module_path_spec.GetPath(), arch);
1329  const ModuleSpec module_spec(module_path_spec, arch);
1330 
1331  ModuleSpecList module_specs;
1332  if (!ObjectFile::GetModuleSpecifications(module_path_spec, 0, 0,
1333  module_specs))
1334  return ModuleSpec();
1335 
1336  ModuleSpec matched_module_spec;
1337  if (!module_specs.FindMatchingModuleSpec(module_spec, matched_module_spec))
1338  return ModuleSpec();
1339 
1340  return matched_module_spec;
1341 }
1342 
1344  const llvm::ArrayRef<llvm::StringRef> client_features) {
1345  // 128KBytes is a reasonable max packet size--debugger can always use less.
1346  constexpr uint32_t max_packet_size = 128 * 1024;
1347 
1348  // Features common to platform server and llgs.
1349  return {
1350  llvm::formatv("PacketSize={0}", max_packet_size),
1351  "QStartNoAckMode+",
1352  "qEcho+",
1353  "native-signals+",
1354  };
1355 }
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qSpeedTest
PacketResult Handle_qSpeedTest(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:469
lldb_private::ProcessInfo::GetArguments
Args & GetArguments()
Definition: ProcessInfo.h:75
lldb_private::Stream::Format
void Format(const char *format, Args &&... args)
Definition: Stream.h:309
lldb_private::ProcessInstanceInfo
Definition: ProcessInfo.h:108
lldb_private::ProcessInstanceInfoMatch::SetNameMatchType
void SetNameMatchType(NameMatch name_match_type)
Definition: ProcessInfo.h:184
StringExtractorGDBRemote::eServerPacketType_qUserName
@ eServerPacketType_qUserName
Definition: StringExtractorGDBRemote.h:66
lldb_private::FileSystem::Open
int Open(const char *path, int flags, int mode)
Wraps ::open in a platform-independent way.
Definition: FileSystemPosix.cpp:78
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qsProcessInfo
PacketResult Handle_qsProcessInfo(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:415
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::GetModuleInfo
ModuleSpec GetModuleInfo(llvm::StringRef module_path, llvm::StringRef triple)
Definition: GDBRemoteCommunicationServerCommon.cpp:1320
lldb_private::ArchSpec::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition: ArchSpec.cpp:731
lldb_private::Host::FindProcesses
static uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &proc_infos)
Definition: common/Host.cpp:615
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Exists
PacketResult Handle_vFile_Exists(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:686
lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendErrorResponse
PacketResult SendErrorResponse(const Status &error)
Definition: GDBRemoteCommunicationServer.cpp:106
lldb_private::StructuredData::Dictionary
Definition: StructuredData.h:352
StringExtractorGDBRemote::eServerPacketType_vFile_pread
@ eServerPacketType_vFile_pread
Definition: StringExtractorGDBRemote.h:85
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::ArchSpec::IsMIPS
bool IsMIPS() const
if MIPS architecture return true.
Definition: ArchSpec.cpp:546
FileSystem.h
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_rdev
llvm::support::ubig32_t gdb_st_rdev
Definition: GDBRemoteCommunication.h:64
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qGroupName
PacketResult Handle_qGroupName(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:450
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_blocks
llvm::support::ubig64_t gdb_st_blocks
Definition: GDBRemoteCommunication.h:67
lldb_private::ProcessInfo::SetArchitecture
void SetArchitecture(const ArchSpec &arch)
Definition: ProcessInfo.h:65
LLDB_INVALID_PROCESS_ID
#define LLDB_INVALID_PROCESS_ID
Definition: lldb-defines.h:81
lldb_private::Stream::PutHex32
size_t PutHex32(uint32_t uvalue, lldb::ByteOrder byte_order=lldb::eByteOrderInvalid)
Definition: Stream.cpp:256
lldb_private::ArchSpec::GetMachine
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
Definition: ArchSpec.cpp:668
ModuleSpec.h
StringExtractor::SetFilePos
void SetFilePos(uint32_t idx)
Definition: StringExtractor.h:39
lldb_private::StructuredData::Array
Definition: StructuredData.h:165
lldb_private::ObjectFile::GetModuleSpecifications
static size_t GetModuleSpecifications(const FileSpec &file, lldb::offset_t file_offset, lldb::offset_t file_size, ModuleSpecList &specs, lldb::DataBufferSP data_sp=lldb::DataBufferSP())
StringExtractor::GetBytesLeft
size_t GetBytesLeft()
Definition: StringExtractor.h:52
StructuredData.h
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_dev
llvm::support::ubig32_t gdb_st_dev
Definition: GDBRemoteCommunication.h:58
StringExtractorGDBRemote::eServerPacketType_A
@ eServerPacketType_A
Definition: StringExtractorGDBRemote.h:52
Host.h
StringExtractor::GetStringRef
llvm::StringRef GetStringRef() const
Definition: StringExtractor.h:48
lldb_private::process_gdb_remote::GDB_EUNKNOWN
@ GDB_EUNKNOWN
Definition: GDBRemoteCommunication.h:78
lldb_private::ProcessInfo::GetGroupID
uint32_t GetGroupID() const
Definition: ProcessInfo.h:51
lldb_private::NativeFile::Read
Status Read(void *buf, size_t &num_bytes) override
Read bytes from a file from the current file position into buf.
Definition: File.cpp:485
lldb_private::ProcessInstanceInfoMatch::SetMatchAllUsers
void SetMatchAllUsers(bool b)
Definition: ProcessInfo.h:180
lldb_private::File::OpenOptions
OpenOptions
Definition: File.h:49
lldb_private::ProcessInfo::GetUserID
uint32_t GetUserID() const
Definition: ProcessInfo.h:49
GDBRemoteCommunicationServerCommon.h
lldb_private::process_gdb_remote::GDBRemoteCommunication::PacketResult
PacketResult
Definition: GDBRemoteCommunication.h:91
fill_clamp
static void fill_clamp(T &dest, U src, typename T::value_type fallback)
Definition: GDBRemoteCommunicationServerCommon.cpp:774
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Mode
PacketResult Handle_vFile_Mode(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:665
lldb_private::ModuleSpecList
Definition: ModuleSpec.h:275
StringExtractorGDBRemote::eServerPacketType_QStartNoAckMode
@ eServerPacketType_QStartNoAckMode
Definition: StringExtractorGDBRemote.h:78
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_size
llvm::support::ubig64_t gdb_st_size
Definition: GDBRemoteCommunication.h:65
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_pRead
PacketResult Handle_vFile_pRead(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:573
lldb_private::NameMatch::StartsWith
@ StartsWith
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:343
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_shell
PacketResult Handle_qPlatform_shell(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:736
lldb_private::Flags::Clear
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
Definition: Flags.h:61
lldb_private::Args::AppendArgument
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
Definition: Args.cpp:318
lldb_private::ProcessInstanceInfo::GetEffectiveGroupID
uint32_t GetEffectiveGroupID() const
Definition: ProcessInfo.h:125
lldb_private::process_gdb_remote::GDBRemoteCommunicationServer
Definition: GDBRemoteCommunicationServer.h:28
StringExtractorGDBRemote::eServerPacketType_vFile_stat
@ eServerPacketType_vFile_stat
Definition: StringExtractorGDBRemote.h:92
lldb_private::ProcessInfo::SetUserID
void SetUserID(uint32_t uid)
Definition: ProcessInfo.h:57
lldb_private::ProcessInstanceInfoMatch
Definition: ProcessInfo.h:163
OptionArgParser.h
lldb_private::ProcessInfo::GetProcessID
lldb::pid_t GetProcessID() const
Definition: ProcessInfo.h:67
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:193
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::LaunchProcess
virtual Status LaunchProcess()=0
Launch a process with the current launch settings.
system_errno_to_gdb
static GDBErrno system_errno_to_gdb(int err)
Definition: GDBRemoteCommunicationServerCommon.cpp:538
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QEnvironment
PacketResult Handle_QEnvironment(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:977
lldb_private::ProcessLaunchInfo::GetFlags
Flags & GetFlags()
Definition: ProcessLaunchInfo.h:64
StringExtractor::GetHexMaxU32
uint32_t GetHexMaxU32(bool little_endian, uint32_t fail_value)
Definition: StringExtractor.cpp:153
lldb_private::ProcessInfo::SetProcessID
void SetProcessID(lldb::pid_t pid)
Definition: ProcessInfo.h:69
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_uid
llvm::support::ubig32_t gdb_st_uid
Definition: GDBRemoteCommunication.h:62
lldb_private::ProcessInstanceInfo::SetEffectiveUserID
void SetEffectiveUserID(uint32_t uid)
Definition: ProcessInfo.h:131
StringExtractorGDBRemote.h
StringExtractorGDBRemote::eServerPacketType_qPlatform_chmod
@ eServerPacketType_qPlatform_chmod
Definition: StringExtractorGDBRemote.h:82
StringExtractorGDBRemote::eServerPacketType_QEnvironment
@ eServerPacketType_QEnvironment
Definition: StringExtractorGDBRemote.h:69
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_ctime
llvm::support::ubig32_t gdb_st_ctime
Definition: GDBRemoteCommunication.h:70
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:455
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_ino
llvm::support::ubig32_t gdb_st_ino
Definition: GDBRemoteCommunication.h:59
StringExtractor
Definition: StringExtractor.h:19
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QEnvironmentHexEncoded
PacketResult Handle_QEnvironmentHexEncoded(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:989
LLDB_INVALID_CPUTYPE
#define LLDB_INVALID_CPUTYPE
Definition: lldb-defines.h:94
StringExtractorGDBRemote::eServerPacketType_QSetSTDOUT
@ eServerPacketType_QSetSTDOUT
Definition: StringExtractorGDBRemote.h:75
lldb_private::ProcessLaunchInfo::AppendFileAction
void AppendFileAction(const FileAction &info)
Definition: ProcessLaunchInfo.h:40
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Open
PacketResult Handle_vFile_Open(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:501
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_blksize
llvm::support::ubig64_t gdb_st_blksize
Definition: GDBRemoteCommunication.h:66
lldb_private::Stream::PutStringAsRawHex8
size_t PutStringAsRawHex8(llvm::StringRef s)
Definition: Stream.cpp:383
lldb_private::FileAction
Definition: FileAction.h:17
lldb_private::UUID::GetAsString
std::string GetAsString(llvm::StringRef separator="-") const
Definition: UUID.cpp:48
StringExtractorGDBRemote::eServerPacketType_qfProcessInfo
@ eServerPacketType_qfProcessInfo
Definition: StringExtractorGDBRemote.h:53
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Size
PacketResult Handle_vFile_Size(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:643
g_default_packet_timeout_sec
const static uint32_t g_default_packet_timeout_sec
Definition: GDBRemoteCommunicationServerCommon.cpp:56
lldb_private::NativeFile::Close
Status Close() override
Flush any buffers and release any resources owned by the file.
Definition: File.cpp:306
StringExtractorGDBRemote::eServerPacketType_vFile_symlink
@ eServerPacketType_vFile_symlink
Definition: StringExtractorGDBRemote.h:93
lldb_private::Environment::insert
std::pair< iterator, bool > insert(llvm::StringRef KeyEqValue)
Definition: Environment.h:71
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Close
PacketResult Handle_vFile_Close(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:550
lldb_private::FileSpec::GetCString
const char * GetCString(bool denormalize=true) const
Definition: FileSpec.cpp:363
StringExtractorGDBRemote::eServerPacketType_qPlatform_mkdir
@ eServerPacketType_qPlatform_mkdir
Definition: StringExtractorGDBRemote.h:81
SafeMachO.h
lldb_private::NameMatch
NameMatch
Definition: NameMatches.h:15
lldb_private::ModuleSpec::GetUUID
UUID & GetUUID()
Definition: ModuleSpec.h:99
lldb_private::FileAction::Open
bool Open(int fd, const FileSpec &file_spec, bool read, bool write)
Definition: FileAction.cpp:32
StringExtractorGDBRemote::GetEscapedBinaryData
size_t GetEscapedBinaryData(std::string &str)
Definition: StringExtractorGDBRemote.cpp:514
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qLaunchSuccess
PacketResult Handle_qLaunchSuccess(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:966
llvm::json
Definition: Trace.cpp:35
Platform.h
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::Status::Success
bool Success() const
Test for success condition.
Definition: Status.cpp:287
lldb_private::StreamString::GetSize
size_t GetSize() const
Definition: StreamString.cpp:38
lldb_private::ArchSpec::GetMachOCPUType
uint32_t GetMachOCPUType() const
Definition: ArchSpec.cpp:636
StringExtractor::Peek
const char * Peek()
Definition: StringExtractor.h:100
StringExtractorGDBRemote::eServerPacketType_vFile_fstat
@ eServerPacketType_vFile_fstat
Definition: StringExtractorGDBRemote.h:91
lldb_private::ProcessInstanceInfo::GetEffectiveUserID
uint32_t GetEffectiveUserID() const
Definition: ProcessInfo.h:123
StringExtractorGDBRemote::eServerPacketType_vFile_size
@ eServerPacketType_vFile_size
Definition: StringExtractorGDBRemote.h:87
Log.h
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_nlink
llvm::support::ubig32_t gdb_st_nlink
Definition: GDBRemoteCommunication.h:61
StringExtractorGDBRemote::eServerPacketType_qProcessInfoPID
@ eServerPacketType_qProcessInfoPID
Definition: StringExtractorGDBRemote.h:64
lldb_private::ProcessInstanceInfo::SetEffectiveGroupID
void SetEffectiveGroupID(uint32_t gid)
Definition: ProcessInfo.h:133
lldb_private::Host::RunShellCommand
static Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const Timeout< std::micro > &timeout, bool run_in_shell=true, bool hide_stderr=false)
Run a shell command.
Definition: common/Host.cpp:378
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_proc_infos
ProcessInstanceInfoList m_proc_infos
Definition: GDBRemoteCommunicationServerCommon.h:36
lldb_private::Status::Fail
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Stat
PacketResult Handle_vFile_Stat(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:822
lldb_private::ProcessInstanceInfoMatch::GetProcessInfo
ProcessInstanceInfo & GetProcessInfo()
Definition: ProcessInfo.h:174
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qProcessInfoPID
PacketResult Handle_qProcessInfoPID(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:315
lldb_private::StructuredData::ObjectSP
std::shared_ptr< Object > ObjectSP
Definition: StructuredData.h:59
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QSetDetachOnError
PacketResult Handle_QSetDetachOnError(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:898
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_process_launch_error
Status m_process_launch_error
Definition: GDBRemoteCommunicationServerCommon.h:35
lldb_private::NameMatch::EndsWith
@ EndsWith
StringExtractorGDBRemote::eServerPacketType_QSetDetachOnError
@ eServerPacketType_QSetDetachOnError
Definition: StringExtractorGDBRemote.h:73
StreamString.h
lldb_private::LLDBLog::Process
@ Process
lldb_private::process_gdb_remote::GDBRemoteCommunication::m_send_acks
bool m_send_acks
Definition: GDBRemoteCommunication.h:178
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::RegisterMemberFunctionHandler
void RegisterMemberFunctionHandler(StringExtractorGDBRemote::ServerPacketType packet_type, PacketResult(T::*handler)(StringExtractorGDBRemote &packet))
Definition: GDBRemoteCommunicationServerCommon.h:118
lldb_private::NameMatch::RegularExpression
@ RegularExpression
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qModuleInfo
PacketResult Handle_qModuleInfo(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:1097
lldb_private::StreamString
Definition: StreamString.h:23
StringExtractorGDBRemote::eServerPacketType_qGroupName
@ eServerPacketType_qGroupName
Definition: StringExtractorGDBRemote.h:57
GDBRemote.h
StringExtractor::GetHexByteStringTerminatedBy
size_t GetHexByteStringTerminatedBy(std::string &str, char terminator)
Definition: StringExtractor.cpp:320
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_mkdir
PacketResult Handle_qPlatform_mkdir(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:851
StringExtractorGDBRemote::eServerPacketType_qSpeedTest
@ eServerPacketType_qSpeedTest
Definition: StringExtractorGDBRemote.h:65
StringExtractorGDBRemote::eServerPacketType_QSetSTDERR
@ eServerPacketType_QSetSTDERR
Definition: StringExtractorGDBRemote.h:76
lldb_private::ArchSpec::GetMachOCPUSubType
uint32_t GetMachOCPUSubType() const
Definition: ArchSpec.cpp:648
StringExtractorGDBRemote::eServerPacketType_jModulesInfo
@ eServerPacketType_jModulesInfo
Definition: StringExtractorGDBRemote.h:131
StringExtractor::GetHexByteStringFixedLength
size_t GetHexByteStringFixedLength(std::string &str, uint32_t nibble_length)
Definition: StringExtractor.cpp:307
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_gid
llvm::support::ubig32_t gdb_st_gid
Definition: GDBRemoteCommunication.h:63
lldb_private::File::eOpenOptionReadOnly
@ eOpenOptionReadOnly
Definition: File.h:50
HostInfo.h
StringExtractor::GetChar
char GetChar(char fail_value='\0')
Definition: StringExtractor.cpp:43
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::FileSystem::Resolve
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
Definition: common/FileSystem.cpp:235
lldb_private::ArchSpec::IsValid
bool IsValid() const
Tests if this ArchSpec is valid.
Definition: ArchSpec.h:353
lldb_private::ModuleSpecList::FindMatchingModuleSpec
bool FindMatchingModuleSpec(const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
Definition: ModuleSpec.h:333
StringExtractor::GetNameColonValue
bool GetNameColonValue(llvm::StringRef &name, llvm::StringRef &value)
Definition: StringExtractor.cpp:333
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qUserName
PacketResult Handle_qUserName(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:427
lldb_private::Stream::PutChar
size_t PutChar(char ch)
Definition: Stream.cpp:104
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qfProcessInfo
PacketResult Handle_qfProcessInfo(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:332
lldb_private::process_gdb_remote
Definition: GDBRemoteClientBase.h:17
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::~GDBRemoteCommunicationServerCommon
~GDBRemoteCommunicationServerCommon() override
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_mtime
llvm::support::ubig32_t gdb_st_mtime
Definition: GDBRemoteCommunication.h:69
StringExtractorGDBRemote::eServerPacketType_qSupported
@ eServerPacketType_qSupported
Definition: StringExtractorGDBRemote.h:121
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:684
ObjectFile.h
StringExtractorGDBRemote::eServerPacketType_qLaunchSuccess
@ eServerPacketType_qLaunchSuccess
Definition: StringExtractorGDBRemote.h:62
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QSetSTDOUT
PacketResult Handle_QSetSTDOUT(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:934
lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendUnimplementedResponse
PacketResult SendUnimplementedResponse(const char *packet)
Definition: GDBRemoteCommunicationServer.cpp:92
StringExtractorGDBRemote::eServerPacketType_vFile_unlink
@ eServerPacketType_vFile_unlink
Definition: StringExtractorGDBRemote.h:94
StringExtractorGDBRemote::eServerPacketType_vFile_md5
@ eServerPacketType_vFile_md5
Definition: StringExtractorGDBRemote.h:90
StringExtractorGDBRemote::eServerPacketType_qModuleInfo
@ eServerPacketType_qModuleInfo
Definition: StringExtractorGDBRemote.h:63
StringExtractor::GetHexByteString
size_t GetHexByteString(std::string &str)
Definition: StringExtractor.cpp:298
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_pWrite
PacketResult Handle_vFile_pWrite(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:608
StringExtractor::GetHexMaxU64
uint64_t GetHexMaxU64(bool little_endian, uint64_t fail_value)
Definition: StringExtractor.cpp:204
lldb_private::File::kInvalidDescriptor
static int kInvalidDescriptor
Definition: File.h:37
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_MD5
PacketResult Handle_vFile_MD5(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:829
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_unlink
PacketResult Handle_vFile_unlink(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:724
lldb_private::StructuredData::Object::GetAsArray
Array * GetAsArray()
Definition: StructuredData.h:85
lldb_private::ModuleSpec::GetFileSpec
FileSpec & GetFileSpec()
Definition: ModuleSpec.h:53
lldb_private::ModuleSpec
Definition: ModuleSpec.h:27
lldb_private::File::eOpenOptionWriteOnly
@ eOpenOptionWriteOnly
Definition: File.h:51
lldb_private::OptionArgParser::ToBoolean
static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr)
Definition: OptionArgParser.cpp:18
lldb_private::ProcessInstanceInfo::GetParentProcessID
lldb::pid_t GetParentProcessID() const
Definition: ProcessInfo.h:135
lldb_private::Stream::PutHex64
size_t PutHex64(uint64_t uvalue, lldb::ByteOrder byte_order=lldb::eByteOrderInvalid)
Definition: Stream.cpp:272
StringExtractorGDBRemote::eServerPacketType_vFile_exists
@ eServerPacketType_vFile_exists
Definition: StringExtractorGDBRemote.h:89
lldb_private::Status
Definition: Status.h:44
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QStartNoAckMode
PacketResult Handle_QStartNoAckMode(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:909
uint32_t
lldb_private::ProcessInfo::GetEnvironment
Environment & GetEnvironment()
Definition: ProcessInfo.h:87
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::FindModuleFile
virtual FileSpec FindModuleFile(const std::string &module_path, const ArchSpec &arch)
Definition: GDBRemoteCommunicationServerCommon.cpp:1308
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
StringExtractorGDBRemote::eServerPacketType_vFile_pwrite
@ eServerPacketType_vFile_pwrite
Definition: StringExtractorGDBRemote.h:86
lldb_private::NameMatch::Contains
@ Contains
lldb_private::endian::InlHostByteOrder
lldb::ByteOrder InlHostByteOrder()
Definition: Endian.h:25
lldb_private::NameMatch::Ignore
@ Ignore
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_atime
llvm::support::ubig32_t gdb_st_atime
Definition: GDBRemoteCommunication.h:68
lldb_private::HostInfoAndroid::ResolveLibraryPath
static FileSpec ResolveLibraryPath(const std::string &path, const ArchSpec &arch)
Definition: HostInfoAndroid.cpp:34
lldb_private::NativeFile
Definition: File.h:377
lldb_private::Host::GetProcessInfo
static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info)
Definition: freebsd/Host.cpp:230
lldb_private::StreamGDBRemote
Definition: GDBRemote.h:27
lldb_private::Stream::AsRawOstream
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition: Stream.h:357
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::HandleFeatures
virtual std::vector< std::string > HandleFeatures(llvm::ArrayRef< llvm::StringRef > client_features)
Definition: GDBRemoteCommunicationServerCommon.cpp:1343
lldb_private::process_gdb_remote::GDBRemoteCommunication::SendPacketNoLock
PacketResult SendPacketNoLock(llvm::StringRef payload)
Definition: GDBRemoteCommunication.cpp:116
StringExtractor::GetS32
int32_t GetS32(int32_t fail_value, int base=0)
Definition: StringExtractor.cpp:108
ProcessGDBRemoteLog.h
lldb::eByteOrderPDP
@ eByteOrderPDP
Definition: lldb-enumerations.h:141
lldb_private::FileSystem::GetPermissions
uint32_t GetPermissions(const FileSpec &file_spec) const
Return the current permissions of the given file.
Definition: common/FileSystem.cpp:122
lldb_private::ModuleSpec::GetArchitecture
ArchSpec & GetArchitecture()
Definition: ModuleSpec.h:89
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_jModulesInfo
PacketResult Handle_jModulesInfo(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:1154
LLDB_LOG
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:336
lldb_private::process_gdb_remote::GDBRemoteCommunicationServer::SendOKResponse
PacketResult SendOKResponse()
Definition: GDBRemoteCommunicationServer.cpp:149
StringExtractorGDBRemote::eServerPacketType_QEnvironmentHexEncoded
@ eServerPacketType_QEnvironmentHexEncoded
Definition: StringExtractorGDBRemote.h:96
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qSupported
PacketResult Handle_qSupported(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:889
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::FileSystem::Symlink
Status Symlink(const FileSpec &src, const FileSpec &dst)
Definition: FileSystemPosix.cpp:36
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_chmod
PacketResult Handle_qPlatform_chmod(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:869
lldb_private::FileSystem::Instance
static FileSystem & Instance()
Definition: common/FileSystem.cpp:46
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QSetSTDERR
PacketResult Handle_QSetSTDERR(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:950
lldb_private::process_gdb_remote::GDBErrno
GDBErrno
Definition: GDBRemoteCommunication.h:75
StringExtractorGDBRemote::eServerPacketType_qEcho
@ eServerPacketType_qEcho
Definition: StringExtractorGDBRemote.h:56
StringExtractorGDBRemote::eServerPacketType_QLaunchArch
@ eServerPacketType_QLaunchArch
Definition: StringExtractorGDBRemote.h:71
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::CreateProcessInfoResponse_DebugServerStyle
static void CreateProcessInfoResponse_DebugServerStyle(const ProcessInstanceInfo &proc_info, StreamString &response)
Definition: GDBRemoteCommunicationServerCommon.cpp:1237
lldb_private::ProcessInfo::GetArchitecture
ArchSpec & GetArchitecture()
Definition: ProcessInfo.h:61
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QSetSTDIN
PacketResult Handle_QSetSTDIN(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:918
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_proc_infos_index
uint32_t m_proc_infos_index
Definition: GDBRemoteCommunicationServerCommon.h:37
lldb_private::StreamGDBRemote::PutEscapedBytes
int PutEscapedBytes(const void *s, size_t src_len)
Output a block of data to the stream performing GDB-remote escaping.
Definition: GDBRemote.cpp:29
lldb_private::ProcessInfo::GetExecutableFile
FileSpec & GetExecutableFile()
Definition: ProcessInfo.h:42
HostInfoAndroid.h
StringExtractorGDBRemote::eServerPacketType_qPlatform_shell
@ eServerPacketType_qPlatform_shell
Definition: StringExtractorGDBRemote.h:80
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::m_process_launch_info
ProcessLaunchInfo m_process_launch_info
Definition: GDBRemoteCommunicationServerCommon.h:34
StringExtractorGDBRemote::eServerPacketType_vFile_mode
@ eServerPacketType_vFile_mode
Definition: StringExtractorGDBRemote.h:88
lldb_private::NativeFile::Write
Status Write(const void *buf, size_t &num_bytes) override
Write bytes from buf to a file at the current file position.
Definition: File.cpp:544
lldb::eByteOrderBig
@ eByteOrderBig
Definition: lldb-enumerations.h:140
lldb_private::ArchSpec::GetTargetABI
std::string GetTargetABI() const
Return a string representing target application ABI.
Definition: ArchSpec.cpp:548
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_A
PacketResult Handle_A(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:1017
lldb_private::Flags::Set
ValueType Set(ValueType mask)
Set one or more flags by logical OR'ing mask with the current flags.
Definition: Flags.h:73
StringExtractorGDBRemote
Definition: StringExtractorGDBRemote.h:21
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_FStat
PacketResult Handle_vFile_FStat(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:783
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_symlink
PacketResult Handle_vFile_symlink(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:706
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qHostInfo
PacketResult Handle_qHostInfo(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:179
lldb_private::ProcessInfo::GetArg0
llvm::StringRef GetArg0() const
Definition: ProcessInfo.cpp:77
lldb_private::StructuredData::ParseJSON
static ObjectSP ParseJSON(const std::string &json_text)
Definition: StructuredData.cpp:25
lldb_private::Log
Definition: Log.h:115
lldb_private::ArchSpec::GetDistributionId
ConstString GetDistributionId() const
Returns the distribution id of the architecture.
Definition: ArchSpec.cpp:676
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::FileSpec::SetFile
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
Definition: FileSpec.cpp:172
lldb_private::StructuredData::Dictionary::GetValueForKeyAsString
bool GetValueForKeyAsString(llvm::StringRef key, llvm::StringRef &result) const
Definition: StructuredData.h:433
lldb_private::process_gdb_remote::GDBRemoteFStatData
Definition: GDBRemoteCommunication.h:57
StringExtractorGDBRemote::eServerPacketType_qHostInfo
@ eServerPacketType_qHostInfo
Definition: StringExtractorGDBRemote.h:58
lldb_private::StructuredData::Array::GetItemAtIndex
ObjectSP GetItemAtIndex(size_t idx) const
Definition: StructuredData.h:188
lldb_private::StructuredData::Array::GetSize
size_t GetSize() const
Definition: StructuredData.h:180
lldb_private::ModuleSpec::GetObjectOffset
uint64_t GetObjectOffset() const
Definition: ModuleSpec.h:107
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:308
FileAction.h
lldb_private::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:347
StringExtractorGDBRemote::eServerPacketType_QSetSTDIN
@ eServerPacketType_QSetSTDIN
Definition: StringExtractorGDBRemote.h:74
StringExtractorGDBRemote::eServerPacketType_qsProcessInfo
@ eServerPacketType_qsProcessInfo
Definition: StringExtractorGDBRemote.h:54
lldb::eByteOrderLittle
@ eByteOrderLittle
Definition: lldb-enumerations.h:142
StringExtractor::GetU32
uint32_t GetU32(uint32_t fail_value, int base=0)
Definition: StringExtractor.cpp:93
StringExtractorGDBRemote::eServerPacketType_vFile_open
@ eServerPacketType_vFile_open
Definition: StringExtractorGDBRemote.h:83
lldb_private::process_gdb_remote::GDBRemoteFStatData::gdb_st_mode
llvm::support::ubig32_t gdb_st_mode
Definition: GDBRemoteCommunication.h:60
lldb
Definition: SBAddress.h:15
File.h
Endian.h
lldb_private::ProcessInstanceInfo::SetParentProcessID
void SetParentProcessID(lldb::pid_t pid)
Definition: ProcessInfo.h:137
LLDBLog.h
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qEcho
PacketResult Handle_qEcho(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:1090
CPU_TYPE_ARM64
#define CPU_TYPE_ARM64
Definition: HostInfoMacOSX.mm:51
lldb_private::ProcessInfo::SetGroupID
void SetGroupID(uint32_t gid)
Definition: ProcessInfo.h:59
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_QLaunchArch
PacketResult Handle_QLaunchArch(StringExtractorGDBRemote &packet)
Definition: GDBRemoteCommunicationServerCommon.cpp:1003
UINT64_MAX
#define UINT64_MAX
Definition: lldb-defines.h:23
StringExtractorGDBRemote::eServerPacketType_vFile_close
@ eServerPacketType_vFile_close
Definition: StringExtractorGDBRemote.h:84
lldb_private::ModuleSpec::GetObjectSize
uint64_t GetObjectSize() const
Definition: ModuleSpec.h:113
lldb_private::Status::AsCString
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:130
lldb_private::NameMatch::Equals
@ Equals
lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::CreateProcessInfoResponse
static void CreateProcessInfoResponse(const ProcessInstanceInfo &proc_info, StreamString &response)
Definition: GDBRemoteCommunicationServerCommon.cpp:1208