LLDB  mainline
SBPlatform.cpp
Go to the documentation of this file.
1 //===-- SBPlatform.cpp ----------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "lldb/API/SBPlatform.h"
10 #include "SBReproducerPrivate.h"
11 #include "lldb/API/SBEnvironment.h"
12 #include "lldb/API/SBError.h"
13 #include "lldb/API/SBFileSpec.h"
14 #include "lldb/API/SBLaunchInfo.h"
15 #include "lldb/API/SBPlatform.h"
16 #include "lldb/API/SBUnixSignals.h"
17 #include "lldb/Host/File.h"
18 #include "lldb/Target/Platform.h"
19 #include "lldb/Target/Target.h"
20 #include "lldb/Utility/ArchSpec.h"
21 #include "lldb/Utility/Args.h"
22 #include "lldb/Utility/Status.h"
23 
24 #include "llvm/Support/FileSystem.h"
25 
26 #include <functional>
27 
28 using namespace lldb;
29 using namespace lldb_private;
30 
31 // PlatformConnectOptions
33  PlatformConnectOptions(const char *url = nullptr)
34  : m_url(), m_rsync_options(), m_rsync_remote_path_prefix(),
35 
36  m_local_cache_directory() {
37  if (url && url[0])
38  m_url = url;
39  }
40 
41  ~PlatformConnectOptions() = default;
42 
46  bool m_rsync_enabled = false;
47  bool m_rsync_omit_hostname_from_remote_path = false;
49 };
50 
51 // PlatformShellCommand
53  PlatformShellCommand(llvm::StringRef shell_interpreter,
54  llvm::StringRef shell_command)
55  : m_command(), m_working_dir(), m_status(0), m_signo(0) {
56  if (!shell_interpreter.empty())
57  m_shell = shell_interpreter.str();
58 
59  if (!m_shell.empty() && !shell_command.empty())
60  m_command = shell_command.str();
61  }
62 
63  PlatformShellCommand(llvm::StringRef shell_command = llvm::StringRef())
64  : m_shell(), m_command(), m_working_dir() {
65  if (!shell_command.empty())
66  m_command = shell_command.str();
67  }
68 
69  ~PlatformShellCommand() = default;
70 
75  int m_status = 0;
76  int m_signo = 0;
77  Timeout<std::ratio<1>> m_timeout = llvm::None;
78 };
79 // SBPlatformConnectOptions
81  : m_opaque_ptr(new PlatformConnectOptions(url)) {
83 }
84 
86  const SBPlatformConnectOptions &rhs)
87  : m_opaque_ptr(new PlatformConnectOptions()) {
89  (const lldb::SBPlatformConnectOptions &), rhs);
90 
91  *m_opaque_ptr = *rhs.m_opaque_ptr;
92 }
93 
95 
100  SBPlatformConnectOptions, operator=,(
102  rhs);
103 
104  *m_opaque_ptr = *rhs.m_opaque_ptr;
105  return LLDB_RECORD_RESULT(*this);
106 }
107 
110 
111  if (m_opaque_ptr->m_url.empty())
112  return nullptr;
113  return m_opaque_ptr->m_url.c_str();
114 }
115 
116 void SBPlatformConnectOptions::SetURL(const char *url) {
117  LLDB_RECORD_METHOD(void, SBPlatformConnectOptions, SetURL, (const char *),
118  url);
119 
120  if (url && url[0])
121  m_opaque_ptr->m_url = url;
122  else
123  m_opaque_ptr->m_url.clear();
124 }
125 
128 
130 }
131 
133  const char *options, const char *remote_path_prefix,
134  bool omit_hostname_from_remote_path) {
136  (const char *, const char *, bool), options,
137  remote_path_prefix, omit_hostname_from_remote_path);
138 
141  omit_hostname_from_remote_path;
142  if (remote_path_prefix && remote_path_prefix[0])
143  m_opaque_ptr->m_rsync_remote_path_prefix = remote_path_prefix;
144  else
146 
147  if (options && options[0])
148  m_opaque_ptr->m_rsync_options = options;
149  else
150  m_opaque_ptr->m_rsync_options.clear();
151 }
152 
155 
156  m_opaque_ptr->m_rsync_enabled = false;
157 }
158 
162 
164 }
165 
168  (const char *), path);
169 
170  if (path && path[0])
172  else
174 }
175 
176 // SBPlatformShellCommand
178  const char *shell_command)
179  : m_opaque_ptr(new PlatformShellCommand(shell_interpreter, shell_command)) {
180  LLDB_RECORD_CONSTRUCTOR(SBPlatformShellCommand, (const char *, const char *),
181  shell_interpreter, shell_command);
182 }
183 
185  : m_opaque_ptr(new PlatformShellCommand(shell_command)) {
187  shell_command);
188 }
189 
191  const SBPlatformShellCommand &rhs)
192  : m_opaque_ptr(new PlatformShellCommand()) {
194  (const lldb::SBPlatformShellCommand &), rhs);
195 
196  *m_opaque_ptr = *rhs.m_opaque_ptr;
197 }
198 
201 
205  rhs);
206 
207  *m_opaque_ptr = *rhs.m_opaque_ptr;
208  return LLDB_RECORD_RESULT(*this);
209 }
210 
212 
215 
217  m_opaque_ptr->m_status = 0;
218  m_opaque_ptr->m_signo = 0;
219 }
220 
223 
224  if (m_opaque_ptr->m_shell.empty())
225  return nullptr;
226  return m_opaque_ptr->m_shell.c_str();
227 }
228 
229 void SBPlatformShellCommand::SetShell(const char *shell_interpreter) {
230  LLDB_RECORD_METHOD(void, SBPlatformShellCommand, SetShell, (const char *),
231  shell_interpreter);
232 
233  if (shell_interpreter && shell_interpreter[0])
234  m_opaque_ptr->m_shell = shell_interpreter;
235  else
236  m_opaque_ptr->m_shell.clear();
237 }
238 
241 
242  if (m_opaque_ptr->m_command.empty())
243  return nullptr;
244  return m_opaque_ptr->m_command.c_str();
245 }
246 
247 void SBPlatformShellCommand::SetCommand(const char *shell_command) {
249  shell_command);
250 
251  if (shell_command && shell_command[0])
252  m_opaque_ptr->m_command = shell_command;
253  else
254  m_opaque_ptr->m_command.clear();
255 }
256 
260 
261  if (m_opaque_ptr->m_working_dir.empty())
262  return nullptr;
263  return m_opaque_ptr->m_working_dir.c_str();
264 }
265 
268  (const char *), path);
269 
270  if (path && path[0])
271  m_opaque_ptr->m_working_dir = path;
272  else
273  m_opaque_ptr->m_working_dir.clear();
274 }
275 
279 
280  if (m_opaque_ptr->m_timeout)
281  return m_opaque_ptr->m_timeout->count();
282  return UINT32_MAX;
283 }
284 
287  (uint32_t), sec);
288 
289  if (sec == UINT32_MAX)
290  m_opaque_ptr->m_timeout = llvm::None;
291  else
292  m_opaque_ptr->m_timeout = std::chrono::seconds(sec);
293 }
294 
297 
298  return m_opaque_ptr->m_signo;
299 }
300 
303 
304  return m_opaque_ptr->m_status;
305 }
306 
309 
310  if (m_opaque_ptr->m_output.empty())
311  return nullptr;
312  return m_opaque_ptr->m_output.c_str();
313 }
314 
315 // SBPlatform
316 SBPlatform::SBPlatform() : m_opaque_sp() {
318 }
319 
320 SBPlatform::SBPlatform(const char *platform_name) : m_opaque_sp() {
321  LLDB_RECORD_CONSTRUCTOR(SBPlatform, (const char *), platform_name);
322 
323  Status error;
324  if (platform_name && platform_name[0])
325  m_opaque_sp = Platform::Create(ConstString(platform_name), error);
326 }
327 
330 
331  m_opaque_sp = rhs.m_opaque_sp;
332 }
333 
336  SBPlatform, operator=,(const lldb::SBPlatform &), rhs);
337 
338  m_opaque_sp = rhs.m_opaque_sp;
339  return LLDB_RECORD_RESULT(*this);
340 }
341 
342 SBPlatform::~SBPlatform() = default;
343 
347 
348  SBPlatform host_platform;
349  host_platform.m_opaque_sp = Platform::GetHostPlatform();
350  return LLDB_RECORD_RESULT(host_platform);
351 }
352 
353 bool SBPlatform::IsValid() const {
355  return this->operator bool();
356 }
357 SBPlatform::operator bool() const {
358  LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBPlatform, operator bool);
359 
360  return m_opaque_sp.get() != nullptr;
361 }
362 
365 
366  m_opaque_sp.reset();
367 }
368 
369 const char *SBPlatform::GetName() {
371 
372  PlatformSP platform_sp(GetSP());
373  if (platform_sp)
374  return platform_sp->GetName().GetCString();
375  return nullptr;
376 }
377 
378 lldb::PlatformSP SBPlatform::GetSP() const { return m_opaque_sp; }
379 
380 void SBPlatform::SetSP(const lldb::PlatformSP &platform_sp) {
381  m_opaque_sp = platform_sp;
382 }
383 
386 
387  PlatformSP platform_sp(GetSP());
388  if (platform_sp)
389  return platform_sp->GetWorkingDirectory().GetCString();
390  return nullptr;
391 }
392 
393 bool SBPlatform::SetWorkingDirectory(const char *path) {
394  LLDB_RECORD_METHOD(bool, SBPlatform, SetWorkingDirectory, (const char *),
395  path);
396 
397  PlatformSP platform_sp(GetSP());
398  if (platform_sp) {
399  if (path)
400  platform_sp->SetWorkingDirectory(FileSpec(path));
401  else
402  platform_sp->SetWorkingDirectory(FileSpec());
403  return true;
404  }
405  return false;
406 }
407 
410  (lldb::SBPlatformConnectOptions &), connect_options);
411 
412  SBError sb_error;
413  PlatformSP platform_sp(GetSP());
414  if (platform_sp && connect_options.GetURL()) {
415  Args args;
416  args.AppendArgument(connect_options.GetURL());
417  sb_error.ref() = platform_sp->ConnectRemote(args);
418  } else {
419  sb_error.SetErrorString("invalid platform");
420  }
421  return LLDB_RECORD_RESULT(sb_error);
422 }
423 
426 
427  PlatformSP platform_sp(GetSP());
428  if (platform_sp)
429  platform_sp->DisconnectRemote();
430 }
431 
434 
435  PlatformSP platform_sp(GetSP());
436  if (platform_sp)
437  return platform_sp->IsConnected();
438  return false;
439 }
440 
441 const char *SBPlatform::GetTriple() {
443 
444  PlatformSP platform_sp(GetSP());
445  if (platform_sp) {
446  ArchSpec arch(platform_sp->GetSystemArchitecture());
447  if (arch.IsValid()) {
448  // Const-ify the string so we don't need to worry about the lifetime of
449  // the string
450  return ConstString(arch.GetTriple().getTriple().c_str()).GetCString();
451  }
452  }
453  return nullptr;
454 }
455 
456 const char *SBPlatform::GetOSBuild() {
458 
459  PlatformSP platform_sp(GetSP());
460  if (platform_sp) {
461  std::string s;
462  if (platform_sp->GetOSBuildString(s)) {
463  if (!s.empty()) {
464  // Const-ify the string so we don't need to worry about the lifetime of
465  // the string
466  return ConstString(s.c_str()).GetCString();
467  }
468  }
469  }
470  return nullptr;
471 }
472 
475 
476  PlatformSP platform_sp(GetSP());
477  if (platform_sp) {
478  std::string s;
479  if (platform_sp->GetOSKernelDescription(s)) {
480  if (!s.empty()) {
481  // Const-ify the string so we don't need to worry about the lifetime of
482  // the string
483  return ConstString(s.c_str()).GetCString();
484  }
485  }
486  }
487  return nullptr;
488 }
489 
490 const char *SBPlatform::GetHostname() {
492 
493  PlatformSP platform_sp(GetSP());
494  if (platform_sp)
495  return platform_sp->GetHostname();
496  return nullptr;
497 }
498 
501 
502  llvm::VersionTuple version;
503  if (PlatformSP platform_sp = GetSP())
504  version = platform_sp->GetOSVersion();
505  return version.empty() ? UINT32_MAX : version.getMajor();
506 }
507 
510 
511  llvm::VersionTuple version;
512  if (PlatformSP platform_sp = GetSP())
513  version = platform_sp->GetOSVersion();
514  return version.getMinor().getValueOr(UINT32_MAX);
515 }
516 
519 
520  llvm::VersionTuple version;
521  if (PlatformSP platform_sp = GetSP())
522  version = platform_sp->GetOSVersion();
523  return version.getSubminor().getValueOr(UINT32_MAX);
524 }
525 
528  (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
529 
530  SBError sb_error;
531  PlatformSP platform_sp(GetSP());
532  if (platform_sp) {
533  sb_error.ref() = platform_sp->GetFile(src.ref(), dst.ref());
534  } else {
535  sb_error.SetErrorString("invalid platform");
536  }
537  return LLDB_RECORD_RESULT(sb_error);
538 }
539 
542  (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
543  return LLDB_RECORD_RESULT(
544  ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
545  if (src.Exists()) {
546  uint32_t permissions =
547  FileSystem::Instance().GetPermissions(src.ref());
548  if (permissions == 0) {
549  if (FileSystem::Instance().IsDirectory(src.ref()))
550  permissions = eFilePermissionsDirectoryDefault;
551  else
552  permissions = eFilePermissionsFileDefault;
553  }
554 
555  return platform_sp->PutFile(src.ref(), dst.ref(), permissions);
556  }
557 
558  Status error;
559  error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
560  src.ref().GetPath().c_str());
561  return error;
562  }));
563 }
564 
565 SBError SBPlatform::Install(SBFileSpec &src, SBFileSpec &dst) {
567  (lldb::SBFileSpec &, lldb::SBFileSpec &), src, dst);
568  return LLDB_RECORD_RESULT(
569  ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
570  if (src.Exists())
571  return platform_sp->Install(src.ref(), dst.ref());
572 
573  Status error;
574  error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
575  src.ref().GetPath().c_str());
576  return error;
577  }));
578 }
579 
582  (lldb::SBPlatformShellCommand &), shell_command);
583  return LLDB_RECORD_RESULT(
584  ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
585  const char *command = shell_command.GetCommand();
586  if (!command)
587  return Status("invalid shell command (empty)");
588 
589  const char *working_dir = shell_command.GetWorkingDirectory();
590  if (working_dir == nullptr) {
591  working_dir = platform_sp->GetWorkingDirectory().GetCString();
592  if (working_dir)
593  shell_command.SetWorkingDirectory(working_dir);
594  }
595  return platform_sp->RunShellCommand(
596  shell_command.m_opaque_ptr->m_shell, command, FileSpec(working_dir),
597  &shell_command.m_opaque_ptr->m_status,
598  &shell_command.m_opaque_ptr->m_signo,
599  &shell_command.m_opaque_ptr->m_output,
600  shell_command.m_opaque_ptr->m_timeout);
601  }));
602 }
603 
606  launch_info);
607  return LLDB_RECORD_RESULT(
608  ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
609  ProcessLaunchInfo info = launch_info.ref();
610  Status error = platform_sp->LaunchProcess(info);
611  launch_info.set_ref(info);
612  return error;
613  }));
614 }
615 
618  return LLDB_RECORD_RESULT(
619  ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
620  return platform_sp->KillProcess(pid);
621  }));
622 }
623 
625  const std::function<Status(const lldb::PlatformSP &)> &func) {
626  SBError sb_error;
627  const auto platform_sp(GetSP());
628  if (platform_sp) {
629  if (platform_sp->IsConnected())
630  sb_error.ref() = func(platform_sp);
631  else
632  sb_error.SetErrorString("not connected");
633  } else
634  sb_error.SetErrorString("invalid platform");
635 
636  return sb_error;
637 }
638 
639 SBError SBPlatform::MakeDirectory(const char *path, uint32_t file_permissions) {
641  (const char *, uint32_t), path, file_permissions);
642 
643  SBError sb_error;
644  PlatformSP platform_sp(GetSP());
645  if (platform_sp) {
646  sb_error.ref() =
647  platform_sp->MakeDirectory(FileSpec(path), file_permissions);
648  } else {
649  sb_error.SetErrorString("invalid platform");
650  }
651  return LLDB_RECORD_RESULT(sb_error);
652 }
653 
656  path);
657 
658  PlatformSP platform_sp(GetSP());
659  if (platform_sp) {
660  uint32_t file_permissions = 0;
661  platform_sp->GetFilePermissions(FileSpec(path), file_permissions);
662  return file_permissions;
663  }
664  return 0;
665 }
666 
668  uint32_t file_permissions) {
670  (const char *, uint32_t), path, file_permissions);
671 
672  SBError sb_error;
673  PlatformSP platform_sp(GetSP());
674  if (platform_sp) {
675  sb_error.ref() =
676  platform_sp->SetFilePermissions(FileSpec(path), file_permissions);
677  } else {
678  sb_error.SetErrorString("invalid platform");
679  }
680  return LLDB_RECORD_RESULT(sb_error);
681 }
682 
686 
687  if (auto platform_sp = GetSP())
688  return LLDB_RECORD_RESULT(SBUnixSignals{platform_sp});
689 
691 }
692 
695  PlatformSP platform_sp(GetSP());
696 
697  if (platform_sp) {
698  return LLDB_RECORD_RESULT(SBEnvironment(platform_sp->GetEnvironment()));
699  }
700 
702 }
703 
704 namespace lldb_private {
705 namespace repro {
706 
713  SBPlatformConnectOptions, operator=,(
715  LLDB_REGISTER_METHOD(const char *, SBPlatformConnectOptions, GetURL, ());
716  LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, SetURL, (const char *));
717  LLDB_REGISTER_METHOD(bool, SBPlatformConnectOptions, GetRsyncEnabled, ());
719  (const char *, const char *, bool));
720  LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, DisableRsync, ());
722  GetLocalCacheDirectory, ());
723  LLDB_REGISTER_METHOD(void, SBPlatformConnectOptions, SetLocalCacheDirectory,
724  (const char *));
725 }
726 
730  (const lldb::SBPlatformShellCommand &));
735  LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand, GetShell, ());
736  LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetShell, (const char *));
737  LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand, GetCommand, ());
739  (const char *));
741  GetWorkingDirectory, ());
742  LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetWorkingDirectory,
743  (const char *));
744  LLDB_REGISTER_METHOD(uint32_t, SBPlatformShellCommand, GetTimeoutSeconds, ());
745  LLDB_REGISTER_METHOD(void, SBPlatformShellCommand, SetTimeoutSeconds,
746  (uint32_t));
747  LLDB_REGISTER_METHOD(int, SBPlatformShellCommand, GetSignal, ());
748  LLDB_REGISTER_METHOD(int, SBPlatformShellCommand, GetStatus, ());
749  LLDB_REGISTER_METHOD(const char *, SBPlatformShellCommand, GetOutput, ());
750 }
751 
752 template <> void RegisterMethods<SBPlatform>(Registry &R) {
754  LLDB_REGISTER_CONSTRUCTOR(SBPlatform, (const char *));
757  (const char *, const char *));
759  SBPlatform, operator=,(const lldb::SBPlatform &));
760  LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, IsValid, ());
761  LLDB_REGISTER_METHOD_CONST(bool, SBPlatform, operator bool,());
762  LLDB_REGISTER_METHOD(void, SBPlatform, Clear, ());
763  LLDB_REGISTER_METHOD(const char *, SBPlatform, GetName, ());
764  LLDB_REGISTER_METHOD(const char *, SBPlatform, GetWorkingDirectory, ());
765  LLDB_REGISTER_METHOD(bool, SBPlatform, SetWorkingDirectory, (const char *));
768  LLDB_REGISTER_METHOD(void, SBPlatform, DisconnectRemote, ());
769  LLDB_REGISTER_METHOD(bool, SBPlatform, IsConnected, ());
770  LLDB_REGISTER_METHOD(const char *, SBPlatform, GetTriple, ());
771  LLDB_REGISTER_METHOD(const char *, SBPlatform, GetOSBuild, ());
772  LLDB_REGISTER_METHOD(const char *, SBPlatform, GetOSDescription, ());
773  LLDB_REGISTER_METHOD(const char *, SBPlatform, GetHostname, ());
774  LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSMajorVersion, ());
775  LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSMinorVersion, ());
776  LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetOSUpdateVersion, ());
786  (lldb::SBLaunchInfo &));
789  (const char *, uint32_t));
790  LLDB_REGISTER_METHOD(uint32_t, SBPlatform, GetFilePermissions,
791  (const char *));
792  LLDB_REGISTER_METHOD(lldb::SBError, SBPlatform, SetFilePermissions,
793  (const char *, uint32_t));
796  ());
798  ());
799 }
800 
801 } // namespace repro
802 } // namespace lldb_private
lldb::SBPlatformShellCommand::SetWorkingDirectory
void SetWorkingDirectory(const char *path)
Definition: SBPlatform.cpp:266
lldb::SBPlatform::ExecuteConnected
SBError ExecuteConnected(const std::function< lldb_private::Status(const lldb::PlatformSP &)> &func)
Definition: SBPlatform.cpp:624
lldb::SBLaunchInfo
Definition: SBLaunchInfo.h:23
LLDB_RECORD_STATIC_METHOD_NO_ARGS
#define LLDB_RECORD_STATIC_METHOD_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:174
lldb::SBPlatformShellCommand::GetShell
const char * GetShell()
Definition: SBPlatform.cpp:221
lldb::SBPlatform::GetHostPlatform
static SBPlatform GetHostPlatform()
Definition: SBPlatform.cpp:344
PlatformShellCommand::m_shell
std::string m_shell
Definition: SBPlatform.cpp:71
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb::SBPlatformConnectOptions::SBPlatformConnectOptions
SBPlatformConnectOptions(const char *url)
Definition: SBPlatform.cpp:80
lldb::SBPlatform::~SBPlatform
~SBPlatform()
PlatformShellCommand::PlatformShellCommand
PlatformShellCommand(llvm::StringRef shell_command=llvm::StringRef())
Definition: SBPlatform.cpp:63
lldb::SBPlatformShellCommand::~SBPlatformShellCommand
~SBPlatformShellCommand()
Definition: SBPlatform.cpp:211
LLDB_RECORD_RESULT
#define LLDB_RECORD_RESULT(Result)
Definition: ReproducerInstrumentation.h:211
SBLaunchInfo.h
LLDB_RECORD_METHOD_CONST_NO_ARGS
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:168
lldb::SBError
Definition: SBError.h:20
PlatformShellCommand::m_status
int m_status
Definition: SBPlatform.cpp:75
LLDB_RECORD_METHOD_NO_ARGS
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:165
PlatformConnectOptions::m_rsync_enabled
bool m_rsync_enabled
Definition: SBPlatform.cpp:46
PlatformConnectOptions
Definition: SBPlatform.cpp:32
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::SBPlatformShellCommand::GetSignal
int GetSignal()
Definition: SBPlatform.cpp:295
lldb::SBPlatformShellCommand::SetCommand
void SetCommand(const char *shell_command)
Definition: SBPlatform.cpp:247
lldb::SBPlatformShellCommand::SetTimeoutSeconds
void SetTimeoutSeconds(uint32_t sec)
Definition: SBPlatform.cpp:285
LLDB_RECORD_CONSTRUCTOR_NO_ARGS
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
Definition: ReproducerInstrumentation.h:136
PlatformConnectOptions::m_local_cache_directory
ConstString m_local_cache_directory
Definition: SBPlatform.cpp:48
lldb::SBPlatform::GetUnixSignals
SBUnixSignals GetUnixSignals() const
Definition: SBPlatform.cpp:683
lldb::SBEnvironment
class LLDB_API SBEnvironment
Definition: SBDefines.h:39
lldb_private::ConstString::SetCString
void SetCString(const char *cstr)
Set the C string value.
Definition: ConstString.cpp:302
LLDB_REGISTER_METHOD_CONST
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:98
lldb_private::repro::RegisterMethods< SBPlatform >
void RegisterMethods< SBPlatform >(Registry &R)
Definition: SBPlatform.cpp:752
lldb::SBPlatform::GetOSUpdateVersion
uint32_t GetOSUpdateVersion()
Definition: SBPlatform.cpp:517
lldb_private::Args
Definition: Args.h:33
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:444
SBReproducerPrivate.h
lldb::SBPlatform::GetName
const char * GetName()
Definition: SBPlatform.cpp:369
LLDB_REGISTER_CONSTRUCTOR
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
Definition: ReproducerInstrumentation.h:89
lldb::SBPlatform::m_opaque_sp
lldb::PlatformSP m_opaque_sp
Definition: SBPlatform.h:182
Target.h
lldb::SBPlatform::SetWorkingDirectory
bool SetWorkingDirectory(const char *path)
Definition: SBPlatform.cpp:393
lldb::SBPlatform::Run
SBError Run(SBPlatformShellCommand &shell_command)
Definition: SBPlatform.cpp:580
Platform.h
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb::SBPlatformConnectOptions::operator=
SBPlatformConnectOptions & operator=(const SBPlatformConnectOptions &rhs)
Definition: SBPlatform.cpp:97
lldb::SBPlatformConnectOptions::m_opaque_ptr
PlatformConnectOptions * m_opaque_ptr
Definition: SBPlatform.h:49
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb::SBPlatform::Install
SBError Install(SBFileSpec &src, SBFileSpec &dst)
Definition: SBPlatform.cpp:565
PlatformShellCommand::m_command
std::string m_command
Definition: SBPlatform.cpp:72
PlatformConnectOptions::m_rsync_remote_path_prefix
std::string m_rsync_remote_path_prefix
Definition: SBPlatform.cpp:45
lldb::SBPlatformConnectOptions::~SBPlatformConnectOptions
~SBPlatformConnectOptions()
Definition: SBPlatform.cpp:94
PlatformConnectOptions::m_rsync_omit_hostname_from_remote_path
bool m_rsync_omit_hostname_from_remote_path
Definition: SBPlatform.cpp:47
LLDB_RECORD_METHOD
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
Definition: ReproducerInstrumentation.h:158
lldb_private::ProcessLaunchInfo
Definition: ProcessLaunchInfo.h:31
lldb::SBPlatform::IsConnected
bool IsConnected()
Definition: SBPlatform.cpp:432
Args.h
lldb::SBPlatformShellCommand::GetOutput
const char * GetOutput()
Definition: SBPlatform.cpp:307
PlatformShellCommand::m_working_dir
std::string m_working_dir
Definition: SBPlatform.cpp:73
lldb::SBPlatform::GetSP
lldb::PlatformSP GetSP() const
Definition: SBPlatform.cpp:378
SBFileSpec.h
lldb::SBPlatform::Put
SBError Put(SBFileSpec &src, SBFileSpec &dst)
Definition: SBPlatform.cpp:540
lldb::SBPlatform::GetEnvironment
SBEnvironment GetEnvironment()
Return the environment variables of the remote platform connection process.
Definition: SBPlatform.cpp:693
lldb::SBPlatform::DisconnectRemote
void DisconnectRemote()
Definition: SBPlatform.cpp:424
GetName
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition: XcodeSDK.cpp:21
lldb::SBPlatform::operator=
SBPlatform & operator=(const SBPlatform &rhs)
Definition: SBPlatform.cpp:334
lldb::SBPlatformConnectOptions
Definition: SBPlatform.h:23
lldb_private::ConstString
Definition: ConstString.h:40
lldb::SBPlatform::SBPlatform
SBPlatform()
Definition: SBPlatform.cpp:316
lldb::SBError::SetErrorString
void SetErrorString(const char *err_str)
Definition: SBError.cpp:124
lldb::SBFileSpec::ref
const lldb_private::FileSpec & ref() const
Definition: SBFileSpec.cpp:168
lldb::SBPlatform::ConnectRemote
SBError ConnectRemote(SBPlatformConnectOptions &connect_options)
Definition: SBPlatform.cpp:408
lldb::SBEnvironment
Definition: SBEnvironment.h:16
lldb::SBPlatform::GetHostname
const char * GetHostname()
Definition: SBPlatform.cpp:490
lldb_private::repro::RegisterMethods< SBPlatformConnectOptions >
void RegisterMethods< SBPlatformConnectOptions >(Registry &R)
Definition: SBPlatform.cpp:707
PlatformShellCommand::m_output
std::string m_output
Definition: SBPlatform.cpp:74
LLDB_REGISTER_STATIC_METHOD
#define LLDB_REGISTER_STATIC_METHOD(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:103
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::ArchSpec::IsValid
bool IsValid() const
Tests if this ArchSpec is valid.
Definition: ArchSpec.h:342
lldb::SBPlatformConnectOptions::DisableRsync
void DisableRsync()
Definition: SBPlatform.cpp:153
lldb::SBPlatformConnectOptions::GetRsyncEnabled
bool GetRsyncEnabled()
Definition: SBPlatform.cpp:126
lldb::SBPlatformShellCommand::Clear
void Clear()
Definition: SBPlatform.cpp:213
lldb::SBPlatformConnectOptions::SetLocalCacheDirectory
void SetLocalCacheDirectory(const char *path)
Definition: SBPlatform.cpp:166
lldb::SBPlatform::GetOSDescription
const char * GetOSDescription()
Definition: SBPlatform.cpp:473
lldb::SBPlatformConnectOptions::SetURL
void SetURL(const char *url)
Definition: SBPlatform.cpp:116
lldb::SBPlatform::IsValid
bool IsValid() const
Definition: SBPlatform.cpp:353
lldb::SBPlatform::GetOSMajorVersion
uint32_t GetOSMajorVersion()
Definition: SBPlatform.cpp:499
lldb::SBPlatformShellCommand::SBPlatformShellCommand
SBPlatformShellCommand(const char *shell, const char *shell_command)
Definition: SBPlatform.cpp:177
lldb::SBPlatformShellCommand::GetTimeoutSeconds
uint32_t GetTimeoutSeconds()
Definition: SBPlatform.cpp:276
LLDB_RECORD_CONSTRUCTOR
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
Definition: ReproducerInstrumentation.h:133
lldb_private::repro::Registry
The registry contains a unique mapping between functions and their ID.
Definition: ReproducerInstrumentation.h:517
lldb::SBPlatform::SetFilePermissions
SBError SetFilePermissions(const char *path, uint32_t file_permissions)
Definition: SBPlatform.cpp:667
lldb::SBPlatformConnectOptions::GetURL
const char * GetURL()
Definition: SBPlatform.cpp:108
lldb_private::Status
Definition: Status.h:44
PlatformShellCommand
Definition: SBPlatform.cpp:52
lldb_private::Timeout
Definition: Connection.h:25
lldb::SBPlatform::Clear
void Clear()
Definition: SBPlatform.cpp:363
lldb::SBUnixSignals
class LLDB_API SBUnixSignals
Definition: SBDefines.h:95
PlatformConnectOptions::m_url
std::string m_url
Definition: SBPlatform.cpp:43
lldb::SBLaunchInfo::ref
const lldb_private::ProcessLaunchInfo & ref() const
Definition: SBLaunchInfo.cpp:67
uint32_t
lldb::SBPlatform::SetSP
void SetSP(const lldb::PlatformSP &platform_sp)
Definition: SBPlatform.cpp:380
PlatformConnectOptions::m_rsync_options
std::string m_rsync_options
Definition: SBPlatform.cpp:44
lldb::SBPlatform::Kill
SBError Kill(const lldb::pid_t pid)
Definition: SBPlatform.cpp:616
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb::SBPlatformShellCommand::m_opaque_ptr
PlatformShellCommand * m_opaque_ptr
Definition: SBPlatform.h:90
lldb::SBPlatform::MakeDirectory
SBError MakeDirectory(const char *path, uint32_t file_permissions=eFilePermissionsDirectoryDefault)
Definition: SBPlatform.cpp:639
lldb::SBPlatformShellCommand::SetShell
void SetShell(const char *shell)
Definition: SBPlatform.cpp:229
lldb::SBPlatformShellCommand::GetCommand
const char * GetCommand()
Definition: SBPlatform.cpp:239
lldb::SBPlatform::GetFilePermissions
uint32_t GetFilePermissions(const char *path)
Definition: SBPlatform.cpp:654
ArchSpec.h
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb::SBLaunchInfo::set_ref
void set_ref(const lldb_private::ProcessLaunchInfo &info)
Definition: SBLaunchInfo.cpp:71
lldb::SBPlatform::GetOSBuild
const char * GetOSBuild()
Definition: SBPlatform.cpp:456
lldb::SBPlatform::GetOSMinorVersion
uint32_t GetOSMinorVersion()
Definition: SBPlatform.cpp:508
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
lldb::SBPlatform::Get
SBError Get(SBFileSpec &src, SBFileSpec &dst)
Definition: SBPlatform.cpp:526
lldb::SBFileSpec
Definition: SBFileSpec.h:16
lldb::SBFileSpec::Exists
bool Exists() const
Definition: SBFileSpec.cpp:89
SBEnvironment.h
Status.h
lldb::SBError::ref
lldb_private::Status & ref()
Definition: SBError.cpp:159
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
PlatformShellCommand::m_timeout
Timeout< std::ratio< 1 > > m_timeout
Definition: SBPlatform.cpp:77
lldb::SBPlatformConnectOptions::GetLocalCacheDirectory
const char * GetLocalCacheDirectory()
Definition: SBPlatform.cpp:159
lldb_private::repro::RegisterMethods< SBPlatformShellCommand >
void RegisterMethods< SBPlatformShellCommand >(Registry &R)
Definition: SBPlatform.cpp:727
SBUnixSignals.h
lldb::SBPlatformShellCommand::GetWorkingDirectory
const char * GetWorkingDirectory()
Definition: SBPlatform.cpp:257
lldb::SBPlatform::GetTriple
const char * GetTriple()
Definition: SBPlatform.cpp:441
lldb::SBPlatformShellCommand::operator=
SBPlatformShellCommand & operator=(const SBPlatformShellCommand &rhs)
Definition: SBPlatform.cpp:200
PlatformConnectOptions::PlatformConnectOptions
PlatformConnectOptions(const char *url=nullptr)
Definition: SBPlatform.cpp:33
lldb::SBPlatformShellCommand
Definition: SBPlatform.h:52
lldb::SBPlatformConnectOptions::EnableRsync
void EnableRsync(const char *options, const char *remote_path_prefix, bool omit_remote_hostname)
Definition: SBPlatform.cpp:132
PlatformShellCommand::m_signo
int m_signo
Definition: SBPlatform.cpp:76
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::SBPlatform
Definition: SBPlatform.h:93
lldb::SBPlatform::Launch
SBError Launch(SBLaunchInfo &launch_info)
Definition: SBPlatform.cpp:604
lldb
Definition: SBAddress.h:15
File.h
lldb::SBPlatformShellCommand::GetStatus
int GetStatus()
Definition: SBPlatform.cpp:301
lldb::SBPlatform::GetWorkingDirectory
const char * GetWorkingDirectory()
Definition: SBPlatform.cpp:384
SBError.h
lldb::SBUnixSignals
Definition: SBUnixSignals.h:17
SBPlatform.h
LLDB_REGISTER_METHOD
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:93
PlatformShellCommand::PlatformShellCommand
PlatformShellCommand(llvm::StringRef shell_interpreter, llvm::StringRef shell_command)
Definition: SBPlatform.cpp:53