LLDB  mainline
PlatformRemoteGDBServer.cpp
Go to the documentation of this file.
1 //===-- PlatformRemoteGDBServer.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 #include "lldb/Host/Config.h"
11 
13 #include "lldb/Core/Debugger.h"
14 #include "lldb/Core/Module.h"
15 #include "lldb/Core/ModuleList.h"
16 #include "lldb/Core/ModuleSpec.h"
18 #include "lldb/Core/StreamFile.h"
20 #include "lldb/Host/Host.h"
21 #include "lldb/Host/HostInfo.h"
22 #include "lldb/Host/PosixApi.h"
23 #include "lldb/Target/Process.h"
24 #include "lldb/Target/Target.h"
25 #include "lldb/Utility/FileSpec.h"
26 #include "lldb/Utility/Log.h"
28 #include "lldb/Utility/Status.h"
30 #include "lldb/Utility/UriParser.h"
31 
34 
35 using namespace lldb;
36 using namespace lldb_private;
37 using namespace lldb_private::platform_gdb_server;
38 
40 
41 static bool g_initialized = false;
42 
43 void PlatformRemoteGDBServer::Initialize() {
44  Platform::Initialize();
45 
46  if (!g_initialized) {
47  g_initialized = true;
48  PluginManager::RegisterPlugin(
49  PlatformRemoteGDBServer::GetPluginNameStatic(),
50  PlatformRemoteGDBServer::GetDescriptionStatic(),
51  PlatformRemoteGDBServer::CreateInstance);
52  }
53 }
54 
55 void PlatformRemoteGDBServer::Terminate() {
56  if (g_initialized) {
57  g_initialized = false;
58  PluginManager::UnregisterPlugin(PlatformRemoteGDBServer::CreateInstance);
59  }
60 
61  Platform::Terminate();
62 }
63 
64 PlatformSP PlatformRemoteGDBServer::CreateInstance(bool force,
65  const ArchSpec *arch) {
66  bool create = force;
67  if (!create) {
68  create = !arch->TripleVendorWasSpecified() && !arch->TripleOSWasSpecified();
69  }
70  if (create)
71  return PlatformSP(new PlatformRemoteGDBServer());
72  return PlatformSP();
73 }
74 
75 ConstString PlatformRemoteGDBServer::GetPluginNameStatic() {
76  static ConstString g_name("remote-gdb-server");
77  return g_name;
78 }
79 
80 const char *PlatformRemoteGDBServer::GetDescriptionStatic() {
81  return "A platform that uses the GDB remote protocol as the communication "
82  "transport.";
83 }
84 
85 const char *PlatformRemoteGDBServer::GetDescription() {
86  if (m_platform_description.empty()) {
87  if (IsConnected()) {
88  // Send the get description packet
89  }
90  }
91 
92  if (!m_platform_description.empty())
93  return m_platform_description.c_str();
94  return GetDescriptionStatic();
95 }
96 
97 Status PlatformRemoteGDBServer::ResolveExecutable(
98  const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp,
99  const FileSpecList *module_search_paths_ptr) {
100  // copied from PlatformRemoteiOS
101 
102  Status error;
103  // Nothing special to do here, just use the actual file and architecture
104 
105  ModuleSpec resolved_module_spec(module_spec);
106 
107  // Resolve any executable within an apk on Android?
108  // Host::ResolveExecutableInBundle (resolved_module_spec.GetFileSpec());
109 
110  if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()) ||
111  module_spec.GetUUID().IsValid()) {
112  if (resolved_module_spec.GetArchitecture().IsValid() ||
113  resolved_module_spec.GetUUID().IsValid()) {
114  error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
115  module_search_paths_ptr, nullptr,
116  nullptr);
117 
118  if (exe_module_sp && exe_module_sp->GetObjectFile())
119  return error;
120  exe_module_sp.reset();
121  }
122  // No valid architecture was specified or the exact arch wasn't found so
123  // ask the platform for the architectures that we should be using (in the
124  // correct order) and see if we can find a match that way
125  StreamString arch_names;
126  for (uint32_t idx = 0; GetSupportedArchitectureAtIndex(
127  idx, resolved_module_spec.GetArchitecture());
128  ++idx) {
129  error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
130  module_search_paths_ptr, nullptr,
131  nullptr);
132  // Did we find an executable using one of the
133  if (error.Success()) {
134  if (exe_module_sp && exe_module_sp->GetObjectFile())
135  break;
136  else
137  error.SetErrorToGenericError();
138  }
139 
140  if (idx > 0)
141  arch_names.PutCString(", ");
142  arch_names.PutCString(
143  resolved_module_spec.GetArchitecture().GetArchitectureName());
144  }
145 
146  if (error.Fail() || !exe_module_sp) {
147  if (FileSystem::Instance().Readable(resolved_module_spec.GetFileSpec())) {
148  error.SetErrorStringWithFormat(
149  "'%s' doesn't contain any '%s' platform architectures: %s",
150  resolved_module_spec.GetFileSpec().GetPath().c_str(),
151  GetPluginName().GetCString(), arch_names.GetData());
152  } else {
153  error.SetErrorStringWithFormat(
154  "'%s' is not readable",
155  resolved_module_spec.GetFileSpec().GetPath().c_str());
156  }
157  }
158  } else {
159  error.SetErrorStringWithFormat(
160  "'%s' does not exist",
161  resolved_module_spec.GetFileSpec().GetPath().c_str());
162  }
163 
164  return error;
165 }
166 
167 bool PlatformRemoteGDBServer::GetModuleSpec(const FileSpec &module_file_spec,
168  const ArchSpec &arch,
169  ModuleSpec &module_spec) {
171 
172  const auto module_path = module_file_spec.GetPath(false);
173 
174  if (!m_gdb_client.GetModuleInfo(module_file_spec, arch, module_spec)) {
175  LLDB_LOGF(
176  log,
177  "PlatformRemoteGDBServer::%s - failed to get module info for %s:%s",
178  __FUNCTION__, module_path.c_str(),
179  arch.GetTriple().getTriple().c_str());
180  return false;
181  }
182 
183  if (log) {
184  StreamString stream;
185  module_spec.Dump(stream);
186  LLDB_LOGF(log,
187  "PlatformRemoteGDBServer::%s - got module info for (%s:%s) : %s",
188  __FUNCTION__, module_path.c_str(),
189  arch.GetTriple().getTriple().c_str(), stream.GetData());
190  }
191 
192  return true;
193 }
194 
195 Status PlatformRemoteGDBServer::GetFileWithUUID(const FileSpec &platform_file,
196  const UUID *uuid_ptr,
197  FileSpec &local_file) {
198  // Default to the local case
199  local_file = platform_file;
200  return Status();
201 }
202 
203 /// Default Constructor
204 PlatformRemoteGDBServer::PlatformRemoteGDBServer()
205  : Platform(false), // This is a remote platform
206  m_gdb_client() {
209 }
210 
211 /// Destructor.
212 ///
213 /// The destructor is virtual since this class is designed to be
214 /// inherited from by the plug-in instance.
216 
218  ArchSpec &arch) {
220 
221  if (idx == 0) {
222  arch = remote_arch;
223  return arch.IsValid();
224  } else if (idx == 1 && remote_arch.IsValid() &&
225  remote_arch.GetTriple().isArch64Bit()) {
226  arch.SetTriple(remote_arch.GetTriple().get32BitArchVariant());
227  return arch.IsValid();
228  }
229  return false;
230 }
231 
233  Target &target, BreakpointSite *bp_site) {
234  // This isn't needed if the z/Z packets are supported in the GDB remote
235  // server. But we might need a packet to detect this.
236  return 0;
237 }
238 
241  return !m_os_version.empty();
242 }
243 
245  return m_gdb_client.GetOSBuildString(s);
246 }
247 
250 }
251 
252 // Remote Platform subclasses need to override this function
255 }
256 
258  if (IsConnected()) {
260  FileSpec working_dir;
261  if (m_gdb_client.GetWorkingDir(working_dir) && log)
262  LLDB_LOGF(log,
263  "PlatformRemoteGDBServer::GetRemoteWorkingDirectory() -> '%s'",
264  working_dir.GetCString());
265  return working_dir;
266  } else {
268  }
269 }
270 
272  const FileSpec &working_dir) {
273  if (IsConnected()) {
274  // Clear the working directory it case it doesn't get set correctly. This
275  // will for use to re-read it
277  LLDB_LOGF(log, "PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')",
278  working_dir.GetCString());
279  return m_gdb_client.SetWorkingDir(working_dir) == 0;
280  } else
281  return Platform::SetRemoteWorkingDirectory(working_dir);
282 }
283 
285  return m_gdb_client.IsConnected();
286 }
287 
289  Status error;
290  if (IsConnected()) {
291  error.SetErrorStringWithFormat("the platform is already connected to '%s', "
292  "execute 'platform disconnect' to close the "
293  "current connection",
294  GetHostname());
295  return error;
296  }
297 
298  if (args.GetArgumentCount() != 1) {
299  error.SetErrorString(
300  "\"platform connect\" takes a single argument: <connect-url>");
301  return error;
302  }
303 
304  const char *url = args.GetArgumentAtIndex(0);
305  if (!url)
306  return Status("URL is null.");
307 
308  int port;
309  llvm::StringRef scheme, hostname, pathname;
310  if (!UriParser::Parse(url, scheme, hostname, port, pathname))
311  return Status("Invalid URL: %s", url);
312 
313  // We're going to reuse the hostname when we connect to the debugserver.
314  m_platform_scheme = std::string(scheme);
315  m_platform_hostname = std::string(hostname);
316 
317  m_gdb_client.SetConnection(std::make_unique<ConnectionFileDescriptor>());
318  if (repro::Reproducer::Instance().IsReplaying()) {
320  if (error.Success())
322  } else {
323  if (repro::Generator *g = repro::Reproducer::Instance().GetGenerator()) {
324  repro::GDBRemoteProvider &provider =
325  g->GetOrCreate<repro::GDBRemoteProvider>();
327  }
328  m_gdb_client.Connect(url, &error);
329  }
330 
331  if (error.Fail())
332  return error;
333 
336  // If a working directory was set prior to connecting, send it down
337  // now.
338  if (m_working_dir)
340  } else {
342  if (error.Success())
343  error.SetErrorString("handshake failed");
344  }
345  return error;
346 }
347 
349  Status error;
351  m_remote_signals_sp.reset();
352  return error;
353 }
354 
357  if (m_name.empty())
358  return nullptr;
359  return m_name.c_str();
360 }
361 
362 llvm::Optional<std::string>
364  std::string name;
365  if (m_gdb_client.GetUserName(uid, name))
366  return std::move(name);
367  return llvm::None;
368 }
369 
370 llvm::Optional<std::string>
372  std::string name;
373  if (m_gdb_client.GetGroupName(gid, name))
374  return std::move(name);
375  return llvm::None;
376 }
377 
379  const ProcessInstanceInfoMatch &match_info,
380  ProcessInstanceInfoList &process_infos) {
381  return m_gdb_client.FindProcesses(match_info, process_infos);
382 }
383 
385  lldb::pid_t pid, ProcessInstanceInfo &process_info) {
386  return m_gdb_client.GetProcessInfo(pid, process_info);
387 }
388 
391  Status error;
392 
393  LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() called", __FUNCTION__);
394 
395  auto num_file_actions = launch_info.GetNumFileActions();
396  for (decltype(num_file_actions) i = 0; i < num_file_actions; ++i) {
397  const auto file_action = launch_info.GetFileActionAtIndex(i);
398  if (file_action->GetAction() != FileAction::eFileActionOpen)
399  continue;
400  switch (file_action->GetFD()) {
401  case STDIN_FILENO:
402  m_gdb_client.SetSTDIN(file_action->GetFileSpec());
403  break;
404  case STDOUT_FILENO:
405  m_gdb_client.SetSTDOUT(file_action->GetFileSpec());
406  break;
407  case STDERR_FILENO:
408  m_gdb_client.SetSTDERR(file_action->GetFileSpec());
409  break;
410  }
411  }
412 
414  launch_info.GetFlags().Test(eLaunchFlagDisableASLR));
416  launch_info.GetFlags().Test(eLaunchFlagDetachOnError));
417 
418  FileSpec working_dir = launch_info.GetWorkingDirectory();
419  if (working_dir) {
420  m_gdb_client.SetWorkingDir(working_dir);
421  }
422 
423  // Send the environment and the program + arguments after we connect
425 
426  ArchSpec arch_spec = launch_info.GetArchitecture();
427  const char *arch_triple = arch_spec.GetTriple().str().c_str();
428 
429  m_gdb_client.SendLaunchArchPacket(arch_triple);
430  LLDB_LOGF(
431  log,
432  "PlatformRemoteGDBServer::%s() set launch architecture triple to '%s'",
433  __FUNCTION__, arch_triple ? arch_triple : "<NULL>");
434 
435  int arg_packet_err;
436  {
437  // Scope for the scoped timeout object
439  m_gdb_client, std::chrono::seconds(5));
440  arg_packet_err = m_gdb_client.SendArgumentsPacket(launch_info);
441  }
442 
443  if (arg_packet_err == 0) {
444  std::string error_str;
445  if (m_gdb_client.GetLaunchSuccess(error_str)) {
446  const auto pid = m_gdb_client.GetCurrentProcessID(false);
447  if (pid != LLDB_INVALID_PROCESS_ID) {
448  launch_info.SetProcessID(pid);
449  LLDB_LOGF(log,
450  "PlatformRemoteGDBServer::%s() pid %" PRIu64
451  " launched successfully",
452  __FUNCTION__, pid);
453  } else {
454  LLDB_LOGF(log,
455  "PlatformRemoteGDBServer::%s() launch succeeded but we "
456  "didn't get a valid process id back!",
457  __FUNCTION__);
458  error.SetErrorString("failed to get PID");
459  }
460  } else {
461  error.SetErrorString(error_str.c_str());
462  LLDB_LOGF(log, "PlatformRemoteGDBServer::%s() launch failed: %s",
463  __FUNCTION__, error.AsCString());
464  }
465  } else {
466  error.SetErrorStringWithFormat("'A' packet returned an error: %i",
467  arg_packet_err);
468  }
469  return error;
470 }
471 
473  if (!KillSpawnedProcess(pid))
474  return Status("failed to kill remote spawned process");
475  return Status();
476 }
477 
479  ProcessLaunchInfo &launch_info, Debugger &debugger,
480  Target *target, // Can be NULL, if NULL create a new target, else use
481  // existing one
482  Status &error) {
483  lldb::ProcessSP process_sp;
484  if (IsRemote()) {
485  if (IsConnected()) {
486  lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID;
487  std::string connect_url;
488  if (!LaunchGDBServer(debugserver_pid, connect_url)) {
489  error.SetErrorStringWithFormat("unable to launch a GDB server on '%s'",
490  GetHostname());
491  } else {
492  if (target == nullptr) {
493  TargetSP new_target_sp;
494 
495  error = debugger.GetTargetList().CreateTarget(
496  debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
497  target = new_target_sp.get();
498  } else
499  error.Clear();
500 
501  if (target && error.Success()) {
502  // The darwin always currently uses the GDB remote debugger plug-in
503  // so even when debugging locally we are debugging remotely!
504  process_sp = target->CreateProcess(launch_info.GetListener(),
505  "gdb-remote", nullptr, true);
506 
507  if (process_sp) {
508  error = process_sp->ConnectRemote(connect_url.c_str());
509  // Retry the connect remote one time...
510  if (error.Fail())
511  error = process_sp->ConnectRemote(connect_url.c_str());
512  if (error.Success())
513  error = process_sp->Launch(launch_info);
514  else if (debugserver_pid != LLDB_INVALID_PROCESS_ID) {
515  printf("error: connect remote failed (%s)\n", error.AsCString());
516  KillSpawnedProcess(debugserver_pid);
517  }
518  }
519  }
520  }
521  } else {
522  error.SetErrorString("not connected to remote gdb server");
523  }
524  }
525  return process_sp;
526 }
527 
529  std::string &connect_url) {
530  ArchSpec remote_arch = GetRemoteSystemArchitecture();
531  llvm::Triple &remote_triple = remote_arch.GetTriple();
532 
533  uint16_t port = 0;
534  std::string socket_name;
535  bool launch_result = false;
536  if (remote_triple.getVendor() == llvm::Triple::Apple &&
537  remote_triple.getOS() == llvm::Triple::IOS) {
538  // When remote debugging to iOS, we use a USB mux that always talks to
539  // localhost, so we will need the remote debugserver to accept connections
540  // only from localhost, no matter what our current hostname is
541  launch_result =
542  m_gdb_client.LaunchGDBServer("127.0.0.1", pid, port, socket_name);
543  } else {
544  // All other hosts should use their actual hostname
545  launch_result =
546  m_gdb_client.LaunchGDBServer(nullptr, pid, port, socket_name);
547  }
548 
549  if (!launch_result)
550  return false;
551 
552  connect_url =
554  (socket_name.empty()) ? nullptr : socket_name.c_str());
555  return true;
556 }
557 
559  return m_gdb_client.KillSpawnedProcess(pid);
560 }
561 
563  ProcessAttachInfo &attach_info, Debugger &debugger,
564  Target *target, // Can be NULL, if NULL create a new target, else use
565  // existing one
566  Status &error) {
567  lldb::ProcessSP process_sp;
568  if (IsRemote()) {
569  if (IsConnected()) {
570  lldb::pid_t debugserver_pid = LLDB_INVALID_PROCESS_ID;
571  std::string connect_url;
572  if (!LaunchGDBServer(debugserver_pid, connect_url)) {
573  error.SetErrorStringWithFormat("unable to launch a GDB server on '%s'",
574  GetHostname());
575  } else {
576  if (target == nullptr) {
577  TargetSP new_target_sp;
578 
579  error = debugger.GetTargetList().CreateTarget(
580  debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
581  target = new_target_sp.get();
582  } else
583  error.Clear();
584 
585  if (target && error.Success()) {
586  // The darwin always currently uses the GDB remote debugger plug-in
587  // so even when debugging locally we are debugging remotely!
588  process_sp =
589  target->CreateProcess(attach_info.GetListenerForProcess(debugger),
590  "gdb-remote", nullptr, true);
591  if (process_sp) {
592  error = process_sp->ConnectRemote(connect_url.c_str());
593  if (error.Success()) {
594  ListenerSP listener_sp = attach_info.GetHijackListener();
595  if (listener_sp)
596  process_sp->HijackProcessEvents(listener_sp);
597  error = process_sp->Attach(attach_info);
598  }
599 
600  if (error.Fail() && debugserver_pid != LLDB_INVALID_PROCESS_ID) {
601  KillSpawnedProcess(debugserver_pid);
602  }
603  }
604  }
605  }
606  } else {
607  error.SetErrorString("not connected to remote gdb server");
608  }
609  }
610  return process_sp;
611 }
612 
614  uint32_t mode) {
615  Status error = m_gdb_client.MakeDirectory(file_spec, mode);
617  LLDB_LOGF(log,
618  "PlatformRemoteGDBServer::MakeDirectory(path='%s', mode=%o) "
619  "error = %u (%s)",
620  file_spec.GetCString(), mode, error.GetError(), error.AsCString());
621  return error;
622 }
623 
625  uint32_t &file_permissions) {
626  Status error = m_gdb_client.GetFilePermissions(file_spec, file_permissions);
628  LLDB_LOGF(log,
629  "PlatformRemoteGDBServer::GetFilePermissions(path='%s', "
630  "file_permissions=%o) error = %u (%s)",
631  file_spec.GetCString(), file_permissions, error.GetError(),
632  error.AsCString());
633  return error;
634 }
635 
637  uint32_t file_permissions) {
638  Status error = m_gdb_client.SetFilePermissions(file_spec, file_permissions);
640  LLDB_LOGF(log,
641  "PlatformRemoteGDBServer::SetFilePermissions(path='%s', "
642  "file_permissions=%o) error = %u (%s)",
643  file_spec.GetCString(), file_permissions, error.GetError(),
644  error.AsCString());
645  return error;
646 }
647 
649  File::OpenOptions flags,
650  uint32_t mode,
651  Status &error) {
652  return m_gdb_client.OpenFile(file_spec, flags, mode, error);
653 }
654 
656  return m_gdb_client.CloseFile(fd, error);
657 }
658 
661  return m_gdb_client.GetFileSize(file_spec);
662 }
663 
665  CompletionRequest &request, bool only_dir) {
667 }
668 
670  void *dst, uint64_t dst_len,
671  Status &error) {
672  return m_gdb_client.ReadFile(fd, offset, dst, dst_len, error);
673 }
674 
676  const void *src, uint64_t src_len,
677  Status &error) {
678  return m_gdb_client.WriteFile(fd, offset, src, src_len, error);
679 }
680 
682  const FileSpec &destination,
683  uint32_t uid, uint32_t gid) {
684  return Platform::PutFile(source, destination, uid, gid);
685 }
686 
688  const FileSpec &src, // The name of the link is in src
689  const FileSpec &dst) // The symlink points to dst
690 {
693  LLDB_LOGF(log,
694  "PlatformRemoteGDBServer::CreateSymlink(src='%s', dst='%s') "
695  "error = %u (%s)",
696  src.GetCString(), dst.GetCString(), error.GetError(),
697  error.AsCString());
698  return error;
699 }
700 
702  Status error = m_gdb_client.Unlink(file_spec);
704  LLDB_LOGF(log, "PlatformRemoteGDBServer::Unlink(path='%s') error = %u (%s)",
705  file_spec.GetCString(), error.GetError(), error.AsCString());
706  return error;
707 }
708 
710  return m_gdb_client.GetFileExists(file_spec);
711 }
712 
714  llvm::StringRef shell, llvm::StringRef command,
715  const FileSpec &
716  working_dir, // Pass empty FileSpec to use the current working directory
717  int *status_ptr, // Pass NULL if you don't want the process exit status
718  int *signo_ptr, // Pass NULL if you don't want the signal that caused the
719  // process to exit
721  *command_output, // Pass NULL if you don't want the command output
722  const Timeout<std::micro> &timeout) {
723  return m_gdb_client.RunShellCommand(command, working_dir, status_ptr,
724  signo_ptr, command_output, timeout);
725 }
726 
728  m_trap_handlers.push_back(ConstString("_sigtramp"));
729 }
730 
732  if (!IsConnected())
734 
736  return m_remote_signals_sp;
737 
738  // If packet not implemented or JSON failed to parse, we'll guess the signal
739  // set based on the remote architecture.
741 
742  StringExtractorGDBRemote response;
743  auto result =
744  m_gdb_client.SendPacketAndWaitForResponse("jSignalsInfo", response);
745 
746  if (result != decltype(result)::Success ||
747  response.GetResponseType() != response.eResponse)
748  return m_remote_signals_sp;
749 
750  auto object_sp =
752  if (!object_sp || !object_sp->IsValid())
753  return m_remote_signals_sp;
754 
755  auto array_sp = object_sp->GetAsArray();
756  if (!array_sp || !array_sp->IsValid())
757  return m_remote_signals_sp;
758 
759  auto remote_signals_sp = std::make_shared<lldb_private::GDBRemoteSignals>();
760 
761  bool done = array_sp->ForEach(
762  [&remote_signals_sp](StructuredData::Object *object) -> bool {
763  if (!object || !object->IsValid())
764  return false;
765 
766  auto dict = object->GetAsDictionary();
767  if (!dict || !dict->IsValid())
768  return false;
769 
770  // Signal number and signal name are required.
771  int signo;
772  if (!dict->GetValueForKeyAsInteger("signo", signo))
773  return false;
774 
775  llvm::StringRef name;
776  if (!dict->GetValueForKeyAsString("name", name))
777  return false;
778 
779  // We can live without short_name, description, etc.
780  bool suppress{false};
781  auto object_sp = dict->GetValueForKey("suppress");
782  if (object_sp && object_sp->IsValid())
783  suppress = object_sp->GetBooleanValue();
784 
785  bool stop{false};
786  object_sp = dict->GetValueForKey("stop");
787  if (object_sp && object_sp->IsValid())
788  stop = object_sp->GetBooleanValue();
789 
790  bool notify{false};
791  object_sp = dict->GetValueForKey("notify");
792  if (object_sp && object_sp->IsValid())
793  notify = object_sp->GetBooleanValue();
794 
795  std::string description{""};
796  object_sp = dict->GetValueForKey("description");
797  if (object_sp && object_sp->IsValid())
798  description = std::string(object_sp->GetStringValue());
799 
800  remote_signals_sp->AddSignal(signo, name.str().c_str(), suppress, stop,
801  notify, description.c_str());
802  return true;
803  });
804 
805  if (done)
806  m_remote_signals_sp = std::move(remote_signals_sp);
807 
808  return m_remote_signals_sp;
809 }
810 
812  const std::string &platform_scheme, const std::string &platform_hostname,
813  uint16_t port, const char *socket_name) {
814  const char *override_scheme =
815  getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_SCHEME");
816  const char *override_hostname =
817  getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_HOSTNAME");
818  const char *port_offset_c_str =
819  getenv("LLDB_PLATFORM_REMOTE_GDB_SERVER_PORT_OFFSET");
820  int port_offset = port_offset_c_str ? ::atoi(port_offset_c_str) : 0;
821 
822  return MakeUrl(override_scheme ? override_scheme : platform_scheme.c_str(),
823  override_hostname ? override_hostname
824  : platform_hostname.c_str(),
825  port + port_offset, socket_name);
826 }
827 
829  const char *hostname,
830  uint16_t port, const char *path) {
831  StreamString result;
832  result.Printf("%s://[%s]", scheme, hostname);
833  if (port != 0)
834  result.Printf(":%u", port);
835  if (path)
836  result.Write(path, strlen(path));
837  return std::string(result.GetString());
838 }
839 
841  Status &error) {
842  std::vector<std::string> connection_urls;
843  GetPendingGdbServerList(connection_urls);
844 
845  for (size_t i = 0; i < connection_urls.size(); ++i) {
846  ConnectProcess(connection_urls[i].c_str(), "gdb-remote", debugger, nullptr, error);
847  if (error.Fail())
848  return i; // We already connected to i process succsessfully
849  }
850  return connection_urls.size();
851 }
852 
854  std::vector<std::string> &connection_urls) {
855  std::vector<std::pair<uint16_t, std::string>> remote_servers;
856  m_gdb_client.QueryGDBServer(remote_servers);
857  for (const auto &gdbserver : remote_servers) {
858  const char *socket_name_cstr =
859  gdbserver.second.empty() ? nullptr : gdbserver.second.c_str();
860  connection_urls.emplace_back(
862  gdbserver.first, socket_name_cstr));
863  }
864  return connection_urls.size();
865 }
lldb_private::ProcessInstanceInfo
Definition: ProcessInfo.h:108
lldb_private::UUID
Definition: UUID.h:23
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::WriteFile
uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, Status &error)
Definition: GDBRemoteCommunicationClient.cpp:3090
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_gdb_client
process_gdb_remote::GDBRemoteCommunicationClient m_gdb_client
Definition: PlatformRemoteGDBServer.h:164
g_initialized
static bool g_initialized
Definition: PlatformRemoteGDBServer.cpp:41
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetSTDIN
int SetSTDIN(const FileSpec &file_spec)
Sets the path to use for stdin/out/err for a process that will be launched with the 'A' packet.
Definition: GDBRemoteCommunicationClient.cpp:1766
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::MakeDirectory
Status MakeDirectory(const FileSpec &file_spec, uint32_t file_permissions) override
Definition: PlatformRemoteGDBServer.cpp:613
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::CalculateTrapHandlerSymbolNames
void CalculateTrapHandlerSymbolNames() override
Ask the Platform subclass to fill in the list of trap handler names.
Definition: PlatformRemoteGDBServer.cpp:727
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::FindProcesses
uint32_t FindProcesses(const ProcessInstanceInfoMatch &process_match_info, ProcessInstanceInfoList &process_infos)
Definition: GDBRemoteCommunicationClient.cpp:2148
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::IsConnected
bool IsConnected() const override
Definition: PlatformRemoteGDBServer.cpp:284
lldb_private::ArchSpec::TripleVendorWasSpecified
bool TripleVendorWasSpecified() const
Definition: ArchSpec.h:347
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetHostname
const char * GetHostname() override
Definition: PlatformRemoteGDBServer.cpp:355
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::DoGetGroupName
llvm::Optional< std::string > DoGetGroupName(UserIDResolver::id_t uid) override
Definition: PlatformRemoteGDBServer.cpp:371
LLDB_INVALID_PROCESS_ID
#define LLDB_INVALID_PROCESS_ID
Definition: lldb-defines.h:92
lldb_private::process_gdb_remote::GDBRemoteCommunication::SetPacketTimeout
std::chrono::seconds SetPacketTimeout(std::chrono::seconds packet_timeout)
Definition: GDBRemoteCommunication.h:120
ModuleSpec.h
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetUserName
bool GetUserName(uint32_t uid, std::string &name)
Definition: GDBRemoteCommunicationClient.cpp:2243
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetWorkingDir
int SetWorkingDir(const FileSpec &working_dir)
Sets the working directory to path for a process that will be launched with the 'A' packet for non pl...
Definition: GDBRemoteCommunicationClient.cpp:1842
Host.h
StringExtractor::GetStringRef
llvm::StringRef GetStringRef() const
Definition: StringExtractor.h:48
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::QueryGDBServer
size_t QueryGDBServer(std::vector< std::pair< uint16_t, std::string >> &connection_urls)
Definition: GDBRemoteCommunicationClient.cpp:2536
lldb_private::Platform::PutFile
virtual Status PutFile(const FileSpec &source, const FileSpec &destination, uint32_t uid=UINT32_MAX, uint32_t gid=UINT32_MAX)
Definition: Platform.cpp:1222
lldb_private::File::OpenOptions
OpenOptions
Definition: File.h:46
lldb_private::UUID::IsValid
bool IsValid() const
Definition: UUID.h:79
lldb_private::ModuleSpec::Dump
void Dump(Stream &strm) const
Definition: ModuleSpec.h:168
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetFileSize
lldb::user_id_t GetFileSize(const FileSpec &file_spec) override
Definition: PlatformRemoteGDBServer.cpp:660
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::DisconnectRemote
Status DisconnectRemote() override
Definition: PlatformRemoteGDBServer.cpp:348
Module.h
BreakpointLocation.h
LIBLLDB_LOG_PLATFORM
#define LIBLLDB_LOG_PLATFORM
Definition: Logging.h:39
PlatformRemoteGDBServer.h
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetSystemArchitecture
ArchSpec GetSystemArchitecture()
Definition: GDBRemoteCommunicationClient.cpp:948
lldb_private::ProcessInstanceInfoMatch
Definition: ProcessInfo.h:165
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_platform_scheme
std::string m_platform_scheme
Definition: PlatformRemoteGDBServer.h:169
lldb_private::Platform::m_os_version
llvm::VersionTuple m_os_version
Definition: Platform.h:889
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::CloseFile
bool CloseFile(lldb::user_id_t fd, Status &error) override
Definition: PlatformRemoteGDBServer.cpp:655
lldb_private::Platform::m_trap_handlers
std::vector< ConstString > m_trap_handlers
Definition: Platform.h:905
lldb_private::Flags::Test
bool Test(ValueType bit) const
Test a single flag bit.
Definition: Flags.h:96
lldb_private::ProcessLaunchInfo::GetFlags
Flags & GetFlags()
Definition: ProcessLaunchInfo.h:64
lldb_private::ProcessInfo::SetProcessID
void SetProcessID(lldb::pid_t pid)
Definition: ProcessInfo.h:69
lldb_private::Args
Definition: Args.h:33
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:444
lldb_private::platform_gdb_server
Definition: PlatformRemoteGDBServer.h:21
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::MakeDirectory
Status MakeDirectory(const FileSpec &file_spec, uint32_t mode)
Definition: GDBRemoteCommunicationClient.cpp:2885
Debugger.h
lldb_private::Target
Definition: Target.h:447
lldb_private::Target::CreateProcess
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
Definition: Target.cpp:200
LLDB_PLUGIN_DEFINE_ADV
LLDB_PLUGIN_DEFINE_ADV(ObjectContainerUniversalMachO, ObjectContainerMachOArchive) void ObjectContainerUniversalMachO
Definition: ObjectContainerUniversalMachO.cpp:23
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetWorkingDir
bool GetWorkingDir(FileSpec &working_dir)
Gets the current working directory of a remote platform GDB server.
Definition: GDBRemoteCommunicationClient.cpp:1826
lldb_private::StreamString::GetString
llvm::StringRef GetString() const
Definition: StreamString.cpp:51
lldb_private::repro::GDBRemoteProvider::GetNewPacketRecorder
PacketRecorder * GetNewPacketRecorder()
Definition: GDBRemote.cpp:125
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetGroupName
bool GetGroupName(uint32_t gid, std::string &name)
Definition: GDBRemoteCommunicationClient.cpp:2270
Process.h
lldb_private::ProcessAttachInfo::GetListenerForProcess
lldb::ListenerSP GetListenerForProcess(Debugger &debugger)
Definition: Process.cpp:2714
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::Connect
Status Connect(process_gdb_remote::GDBRemoteCommunicationClient &client)
Definition: GDBRemoteCommunicationReplayServer.cpp:291
lldb_private::FileSpec::GetCString
const char * GetCString(bool denormalize=true) const
Definition: FileSpec.cpp:364
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::PutFile
Status PutFile(const FileSpec &source, const FileSpec &destination, uint32_t uid=UINT32_MAX, uint32_t gid=UINT32_MAX) override
Definition: PlatformRemoteGDBServer.cpp:681
Target.h
lldb_private::Communication::SetConnection
void SetConnection(std::unique_ptr< Connection > connection)
Sets the connection that it to be used by this class.
Definition: Communication.cpp:413
lldb_private::ModuleSpec::GetUUID
UUID & GetUUID()
Definition: ModuleSpec.h:105
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetRemoteOSBuildString
bool GetRemoteOSBuildString(std::string &s) override
Definition: PlatformRemoteGDBServer.cpp:244
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetFileExists
bool GetFileExists(const FileSpec &file_spec) override
Definition: PlatformRemoteGDBServer.cpp:709
ProcessInfo.h
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetPendingGdbServerList
virtual size_t GetPendingGdbServerList(std::vector< std::string > &connection_urls)
Definition: PlatformRemoteGDBServer.cpp:853
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetHostInfo
bool GetHostInfo(bool force=false)
Definition: GDBRemoteCommunicationClient.cpp:1127
ProcessGDBRemote.h
ModuleList.h
lldb_private::BreakpointSite
Definition: BreakpointSite.h:35
object
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::KillSpawnedProcess
bool KillSpawnedProcess(lldb::pid_t pid)
Definition: GDBRemoteCommunicationClient.cpp:2575
lldb_private::ProcessLaunchInfo
Definition: ProcessLaunchInfo.h:31
Log.h
lldb_private::Platform::GetRemoteWorkingDirectory
virtual FileSpec GetRemoteWorkingDirectory()
Definition: Platform.h:261
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetRemoteWorkingDirectory
FileSpec GetRemoteWorkingDirectory() override
Definition: PlatformRemoteGDBServer.cpp:257
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::SetFilePermissions
Status SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions) override
Definition: PlatformRemoteGDBServer.cpp:636
lldb_private::eLoadDependentsNo
@ eLoadDependentsNo
Definition: Target.h:65
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetSTDERR
int SetSTDERR(const FileSpec &file_spec)
Definition: GDBRemoteCommunicationClient.cpp:1806
lldb_private::ArchSpec::SetTriple
bool SetTriple(const llvm::Triple &triple)
Architecture triple setter.
Definition: ArchSpec.cpp:739
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::LaunchGDBServer
virtual bool LaunchGDBServer(lldb::pid_t &pid, std::string &connect_url)
Definition: PlatformRemoteGDBServer.cpp:528
lldb_private::UriParser::Parse
static bool Parse(llvm::StringRef uri, llvm::StringRef &scheme, llvm::StringRef &hostname, int &port, llvm::StringRef &path)
Definition: UriParser.cpp:19
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::KillSpawnedProcess
virtual bool KillSpawnedProcess(lldb::pid_t pid)
Definition: PlatformRemoteGDBServer.cpp:558
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetRemoteOSVersion
bool GetRemoteOSVersion() override
Definition: PlatformRemoteGDBServer.cpp:239
lldb_private::Platform::SetRemoteWorkingDirectory
virtual bool SetRemoteWorkingDirectory(const FileSpec &working_dir)
Definition: Platform.cpp:824
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::Unlink
Status Unlink(const FileSpec &file_spec)
Definition: GDBRemoteCommunicationClient.cpp:3156
StreamString.h
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::AutoCompleteDiskFileOrDirectory
void AutoCompleteDiskFileOrDirectory(CompletionRequest &request, bool only_dir) override
Definition: PlatformRemoteGDBServer.cpp:664
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetProcessInfo
bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override
Definition: PlatformRemoteGDBServer.cpp:384
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetRemoteSystemArchitecture
ArchSpec GetRemoteSystemArchitecture() override
Definition: PlatformRemoteGDBServer.cpp:253
StringExtractorGDBRemote::eResponse
@ eResponse
Definition: StringExtractorGDBRemote.h:174
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetFileExists
bool GetFileExists(const FileSpec &file_spec)
Definition: GDBRemoteCommunicationClient.cpp:3188
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::StreamString
Definition: StreamString.h:23
StringExtractorGDBRemote::GetResponseType
ResponseType GetResponseType() const
Definition: StringExtractorGDBRemote.cpp:18
lldb_private::process_gdb_remote::GDBRemoteCommunication::SetPacketRecorder
void SetPacketRecorder(repro::PacketRecorder *recorder)
Definition: GDBRemoteCommunication.cpp:1225
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetFilePermissions
Status SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions)
Definition: GDBRemoteCommunicationClient.cpp:2906
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::CreateSymlink
Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override
Definition: PlatformRemoteGDBServer.cpp:687
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetDetachOnError
int SetDetachOnError(bool enable)
Sets the DetachOnError flag to enable for the process controlled by the stub.
Definition: GDBRemoteCommunicationClient.cpp:1879
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::CloseFile
bool CloseFile(lldb::user_id_t fd, Status &error)
Definition: GDBRemoteCommunicationClient.cpp:2966
lldb_private::GetLogIfAllCategoriesSet
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:58
lldb_private::Platform::m_working_dir
FileSpec m_working_dir
Definition: Platform.h:885
lldb_private::TargetList::CreateTarget
Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, LoadDependentFiles get_dependent_modules, const OptionGroupPlatform *platform_options, lldb::TargetSP &target_sp)
Create a new Target.
lldb_private::ProcessLaunchInfo::GetFileActionAtIndex
const FileAction * GetFileActionAtIndex(size_t idx) const
Definition: ProcessLaunchInfo.cpp:111
if
if(CMAKE_SYSTEM_NAME MATCHES "Windows") add_definitions(-DEXPORT_LIBLLDB) endif() get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS) if(LLDB_BUILD_FRAMEWORK) set(option_install_prefix INSTALL_PREFIX $
Definition: API/CMakeLists.txt:1
lldb_private::ProcessLaunchInfo::GetListener
lldb::ListenerSP GetListener() const
Definition: ProcessLaunchInfo.h:128
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetSoftwareBreakpointTrapOpcode
size_t GetSoftwareBreakpointTrapOpcode(Target &target, BreakpointSite *bp_site) override
Definition: PlatformRemoteGDBServer.cpp:232
lldb_private::ArchSpec::TripleOSWasSpecified
bool TripleOSWasSpecified() const
Definition: ArchSpec.h:351
ConnectionFileDescriptor.h
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::CreateSymlink
Status CreateSymlink(const FileSpec &src, const FileSpec &dst)
Definition: GDBRemoteCommunicationClient.cpp:3122
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::SetRemoteWorkingDirectory
bool SetRemoteWorkingDirectory(const FileSpec &working_dir) override
Definition: PlatformRemoteGDBServer.cpp:271
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::ReadFile
uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, Status &error)
Definition: GDBRemoteCommunicationClient.cpp:3057
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::ConnectRemote
Status ConnectRemote(Args &args) override
Definition: PlatformRemoteGDBServer.cpp:288
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetProcessInfo
bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info)
Definition: GDBRemoteCommunicationClient.cpp:1993
lldb_private::Debugger
Definition: Debugger.h:70
lldb_private::process_gdb_remote::GDBRemoteCommunicationReplayServer::StartAsyncThread
bool StartAsyncThread()
Definition: GDBRemoteCommunicationReplayServer.cpp:209
HostInfo.h
lldb_private::ProcessLaunchInfo::GetNumFileActions
size_t GetNumFileActions() const
Definition: ProcessLaunchInfo.h:58
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:38
lldb_private::ProcessLaunchInfo::GetWorkingDirectory
const FileSpec & GetWorkingDirectory() const
Definition: ProcessLaunchInfo.cpp:125
lldb_private::ArchSpec::IsValid
bool IsValid() const
Tests if this ArchSpec is valid.
Definition: ArchSpec.h:342
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetFilePermissions
Status GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions)
Definition: GDBRemoteCommunicationClient.cpp:3022
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::~PlatformRemoteGDBServer
~PlatformRemoteGDBServer() override
Destructor.
Definition: PlatformRemoteGDBServer.cpp:215
lldb_private::Platform::GetRemoteUnixSignals
virtual const lldb::UnixSignalsSP & GetRemoteUnixSignals()
Definition: Platform.cpp:1714
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetRemoteOSKernelDescription
bool GetRemoteOSKernelDescription(std::string &s) override
Definition: PlatformRemoteGDBServer.cpp:248
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::FindProcesses
uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) override
Attach to an existing process by process name.
Definition: PlatformRemoteGDBServer.cpp:378
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::OpenFile
lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags, uint32_t mode, Status &error) override
Definition: PlatformRemoteGDBServer.cpp:648
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::Unlink
Status Unlink(const FileSpec &path) override
Definition: PlatformRemoteGDBServer.cpp:701
lldb_private::ProcessAttachInfo
Definition: Process.h:113
lldb_private::Debugger::GetTargetList
TargetList & GetTargetList()
Get accessor for the target list.
Definition: Debugger.h:223
lldb_private::FileAction::eFileActionOpen
@ eFileActionOpen
Definition: FileAction.h:23
lldb_private::Platform::IsRemote
bool IsRemote() const
Definition: Platform.h:446
lldb_private::process_gdb_remote::GDBRemoteCommunication::ScopedTimeout
Definition: GDBRemoteCommunication.h:83
StreamFile.h
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::WriteFile
uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *data, uint64_t len, Status &error) override
Definition: PlatformRemoteGDBServer.cpp:675
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_platform_hostname
std::string m_platform_hostname
Definition: PlatformRemoteGDBServer.h:170
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::OpenFile
lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags, mode_t mode, Status &error)
Definition: GDBRemoteCommunicationClient.cpp:2945
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendEnvironment
int SendEnvironment(const Environment &env)
Definition: GDBRemoteCommunicationClient.cpp:793
lldb_private::ModuleSpec::GetFileSpec
FileSpec & GetFileSpec()
Definition: ModuleSpec.h:59
lldb_private::Communication::Disconnect
lldb::ConnectionStatus Disconnect(Status *error_ptr=nullptr)
Disconnect the communications connection if one is currently connected.
Definition: Communication.cpp:92
lldb_private::ModuleSpec
Definition: ModuleSpec.h:26
lldb_private::Status
Definition: Status.h:44
lldb_private::Args::GetArgumentAtIndex
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
Definition: Args.cpp:259
lldb_private::Timeout< std::micro >
lldb_private::ArchSpec::GetArchitectureName
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
Definition: ArchSpec.cpp:538
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::RunShellCommand
Status RunShellCommand(llvm::StringRef shell, llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const lldb_private::Timeout< std::micro > &timeout) override
Definition: PlatformRemoteGDBServer.cpp:713
uint32_t
lldb_private::ProcessInfo::GetEnvironment
Environment & GetEnvironment()
Definition: ProcessInfo.h:87
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_gdb_replay_server
process_gdb_remote::GDBRemoteCommunicationReplayServer m_gdb_replay_server
Definition: PlatformRemoteGDBServer.h:165
lldb_private::Platform::m_name
std::string m_name
Definition: Platform.h:888
GDBRemoteSignals.h
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::KillProcess
Status KillProcess(const lldb::pid_t pid) override
Kill process on a platform.
Definition: PlatformRemoteGDBServer.cpp:472
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetFileSize
lldb::user_id_t GetFileSize(const FileSpec &file_spec)
Definition: GDBRemoteCommunicationClient.cpp:2979
lldb_private::Communication::IsConnected
bool IsConnected() const
Check if the connection is valid.
Definition: Communication.cpp:116
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::LaunchGDBServer
bool LaunchGDBServer(const char *remote_accept_hostname, lldb::pid_t &pid, uint16_t &port, std::string &socket_name)
Definition: GDBRemoteCommunicationClient.cpp:2491
uint16_t
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendArgumentsPacket
int SendArgumentsPacket(const ProcessLaunchInfo &launch_info)
Sends a GDB remote protocol 'A' packet that delivers program arguments to the remote server.
Definition: GDBRemoteCommunicationClient.cpp:743
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::RunShellCommand
Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const Timeout< std::micro > &timeout)
Definition: GDBRemoteCommunicationClient.cpp:2832
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetRemoteUnixSignals
const lldb::UnixSignalsSP & GetRemoteUnixSignals() override
Definition: PlatformRemoteGDBServer.cpp:731
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetOSBuildString
bool GetOSBuildString(std::string &s)
Definition: GDBRemoteCommunicationClient.cpp:915
PluginManager.h
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetCurrentProcessID
lldb::pid_t GetCurrentProcessID(bool allow_lazy=true)
Definition: GDBRemoteCommunicationClient.cpp:676
lldb_private::ModuleSpec::GetArchitecture
ArchSpec & GetArchitecture()
Definition: ModuleSpec.h:95
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetSTDOUT
int SetSTDOUT(const FileSpec &file_spec)
Definition: GDBRemoteCommunicationClient.cpp:1786
lldb_private::Platform
Definition: Platform.h:72
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::platform_gdb_server::PlatformRemoteGDBServer::MakeGdbServerUrl
std::string MakeGdbServerUrl(const std::string &platform_scheme, const std::string &platform_hostname, uint16_t port, const char *socket_name)
Definition: PlatformRemoteGDBServer.cpp:811
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::ConnectToWaitingProcesses
size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger, lldb_private::Status &error) override
Connect to all processes waiting for a debugger to attach.
Definition: PlatformRemoteGDBServer.cpp:840
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SetDisableASLR
int SetDisableASLR(bool enable)
Sets the disable ASLR flag to enable for a process that will be launched with the 'A' packet.
Definition: GDBRemoteCommunicationClient.cpp:1862
lldb_private::process_gdb_remote::GDBRemoteClientBase::SendPacketAndWaitForResponse
PacketResult SendPacketAndWaitForResponse(llvm::StringRef payload, StringExtractorGDBRemote &response, std::chrono::seconds interrupt_timeout=std::chrono::seconds(0))
Definition: GDBRemoteClientBase.cpp:179
Status.h
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetFilePermissions
Status GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions) override
Definition: PlatformRemoteGDBServer.cpp:624
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::LineStatus::Success
@ Success
PosixApi.h
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::HandshakeWithServer
bool HandshakeWithServer(Status *error_ptr)
Definition: GDBRemoteCommunicationClient.cpp:117
FileSpec.h
lldb_private::repro::GDBRemoteProvider
Definition: GDBRemote.h:98
lldb_private::Stream::Write
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
Definition: Stream.h:101
lldb_private::platform_gdb_server::PlatformRemoteGDBServer
Definition: PlatformRemoteGDBServer.h:23
StringExtractorGDBRemote
Definition: StringExtractorGDBRemote.h:21
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::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::LaunchProcess
Status LaunchProcess(ProcessLaunchInfo &launch_info) override
Launch a new process on a platform, not necessarily for debugging, it could be just for running the p...
Definition: PlatformRemoteGDBServer.cpp:389
UriParser.h
lldb_private::GetLogIfAnyCategoriesSet
Log * GetLogIfAnyCategoriesSet(uint32_t mask)
Definition: Logging.cpp:62
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::MakeUrl
virtual std::string MakeUrl(const char *scheme, const char *hostname, uint16_t port, const char *path)
Definition: PlatformRemoteGDBServer.cpp:828
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::DoGetUserName
llvm::Optional< std::string > DoGetUserName(UserIDResolver::id_t uid) override
Definition: PlatformRemoteGDBServer.cpp:363
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
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetOSKernelDescription
bool GetOSKernelDescription(std::string &s)
Definition: GDBRemoteCommunicationClient.cpp:926
lldb_private::ProcessAttachInfo::GetHijackListener
lldb::ListenerSP GetHijackListener() const
Definition: Process.h:181
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetHostname
bool GetHostname(std::string &s)
Definition: GDBRemoteCommunicationClient.cpp:937
lldb_private::repro::Reproducer::Instance
static Reproducer & Instance()
Definition: Reproducer.cpp:23
lldb_private::repro::Generator
The generator is responsible for the logic needed to generate a reproducer.
Definition: Reproducer.h:91
lldb_private::Args::GetArgumentCount
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
Definition: Args.h:118
lldb_private::ProcessInstanceInfoList
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
Definition: Host.h:30
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetOSVersion
llvm::VersionTuple GetOSVersion()
Definition: GDBRemoteCommunicationClient.cpp:905
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetLaunchSuccess
bool GetLaunchSuccess(std::string &error_str)
Definition: GDBRemoteCommunicationClient.cpp:724
lldb_private::StructuredData::Object
Definition: StructuredData.h:70
lldb
Definition: SBAddress.h:15
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::ReadFile
uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *data_ptr, uint64_t len, Status &error) override
Definition: PlatformRemoteGDBServer.cpp:669
lldb_private::process_gdb_remote::ProcessGDBRemote::GetPacketTimeout
static std::chrono::seconds GetPacketTimeout()
Definition: ProcessGDBRemote.cpp:216
lldb_private::Platform::ConnectProcess
virtual lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, Debugger &debugger, Target *target, Status &error)
Definition: Platform.cpp:1793
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendLaunchArchPacket
int SendLaunchArchPacket(const char *arch)
Definition: GDBRemoteCommunicationClient.cpp:860
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::Attach
lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, Status &error) override
Attach to an existing process using a process ID.
Definition: PlatformRemoteGDBServer.cpp:562
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::AutoCompleteDiskFileOrDirectory
void AutoCompleteDiskFileOrDirectory(CompletionRequest &request, bool only_dir)
Definition: GDBRemoteCommunicationClient.cpp:2996
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::m_remote_signals_sp
lldb::UnixSignalsSP m_remote_signals_sp
Definition: PlatformRemoteGDBServer.h:172
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::DebugProcess
lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, Status &error) override
Subclasses do not need to implement this function as it uses the Platform::LaunchProcess() followed b...
Definition: PlatformRemoteGDBServer.cpp:478
lldb_private::platform_gdb_server::PlatformRemoteGDBServer::GetSupportedArchitectureAtIndex
bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override
Get the platform's supported architectures in the order in which they should be searched.
Definition: PlatformRemoteGDBServer.cpp:217
lldb_private::UnixSignals::Create
static lldb::UnixSignalsSP Create(const ArchSpec &arch)
Definition: UnixSignals.cpp:30
lldb_private::Communication::Connect
lldb::ConnectionStatus Connect(const char *url, Status *error_ptr)
Connect using the current connection by passing url to its connect function.
Definition: Communication.cpp:78