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