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