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 "lldb/API/SBEnvironment.h"
11 #include "lldb/API/SBError.h"
12 #include "lldb/API/SBFileSpec.h"
13 #include "lldb/API/SBLaunchInfo.h"
14 #include "lldb/API/SBPlatform.h"
15 #include "lldb/API/SBUnixSignals.h"
16 #include "lldb/Host/File.h"
17 #include "lldb/Target/Platform.h"
18 #include "lldb/Target/Target.h"
19 #include "lldb/Utility/ArchSpec.h"
20 #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  if (url && url[0])
35  m_url = url;
36  }
37 
38  ~PlatformConnectOptions() = default;
39 
43  bool m_rsync_enabled = false;
44  bool m_rsync_omit_hostname_from_remote_path = false;
46 };
47 
48 // PlatformShellCommand
50  PlatformShellCommand(llvm::StringRef shell_interpreter,
51  llvm::StringRef shell_command) {
52  if (!shell_interpreter.empty())
53  m_shell = shell_interpreter.str();
54 
55  if (!m_shell.empty() && !shell_command.empty())
56  m_command = shell_command.str();
57  }
58 
59  PlatformShellCommand(llvm::StringRef shell_command = llvm::StringRef()) {
60  if (!shell_command.empty())
61  m_command = shell_command.str();
62  }
63 
64  ~PlatformShellCommand() = default;
65 
70  int m_status = 0;
71  int m_signo = 0;
72  Timeout<std::ratio<1>> m_timeout = llvm::None;
73 };
74 // SBPlatformConnectOptions
76  : m_opaque_ptr(new PlatformConnectOptions(url)) {
77  LLDB_INSTRUMENT_VA(this, url);
78 }
79 
81  const SBPlatformConnectOptions &rhs)
82  : m_opaque_ptr(new PlatformConnectOptions()) {
83  LLDB_INSTRUMENT_VA(this, rhs);
84 
85  *m_opaque_ptr = *rhs.m_opaque_ptr;
86 }
87 
89 
92  LLDB_INSTRUMENT_VA(this, rhs);
93 
94  *m_opaque_ptr = *rhs.m_opaque_ptr;
95  return *this;
96 }
97 
99  LLDB_INSTRUMENT_VA(this);
100 
101  if (m_opaque_ptr->m_url.empty())
102  return nullptr;
103  return m_opaque_ptr->m_url.c_str();
104 }
105 
106 void SBPlatformConnectOptions::SetURL(const char *url) {
107  LLDB_INSTRUMENT_VA(this, url);
108 
109  if (url && url[0])
110  m_opaque_ptr->m_url = url;
111  else
112  m_opaque_ptr->m_url.clear();
113 }
114 
116  LLDB_INSTRUMENT_VA(this);
117 
119 }
120 
122  const char *options, const char *remote_path_prefix,
123  bool omit_hostname_from_remote_path) {
124  LLDB_INSTRUMENT_VA(this, options, remote_path_prefix,
125  omit_hostname_from_remote_path);
126 
129  omit_hostname_from_remote_path;
130  if (remote_path_prefix && remote_path_prefix[0])
131  m_opaque_ptr->m_rsync_remote_path_prefix = remote_path_prefix;
132  else
134 
135  if (options && options[0])
136  m_opaque_ptr->m_rsync_options = options;
137  else
138  m_opaque_ptr->m_rsync_options.clear();
139 }
140 
142  LLDB_INSTRUMENT_VA(this);
143 
144  m_opaque_ptr->m_rsync_enabled = false;
145 }
146 
148  LLDB_INSTRUMENT_VA(this);
149 
151 }
152 
154  LLDB_INSTRUMENT_VA(this, path);
155 
156  if (path && path[0])
158  else
160 }
161 
162 // SBPlatformShellCommand
164  const char *shell_command)
165  : m_opaque_ptr(new PlatformShellCommand(shell_interpreter, shell_command)) {
166  LLDB_INSTRUMENT_VA(this, shell_interpreter, shell_command);
167 }
168 
170  : m_opaque_ptr(new PlatformShellCommand(shell_command)) {
171  LLDB_INSTRUMENT_VA(this, shell_command);
172 }
173 
175  const SBPlatformShellCommand &rhs)
176  : m_opaque_ptr(new PlatformShellCommand()) {
177  LLDB_INSTRUMENT_VA(this, rhs);
178 
179  *m_opaque_ptr = *rhs.m_opaque_ptr;
180 }
181 
184 
185  LLDB_INSTRUMENT_VA(this, rhs);
186 
187  *m_opaque_ptr = *rhs.m_opaque_ptr;
188  return *this;
189 }
190 
192 
194  LLDB_INSTRUMENT_VA(this);
195 
197  m_opaque_ptr->m_status = 0;
198  m_opaque_ptr->m_signo = 0;
199 }
200 
202  LLDB_INSTRUMENT_VA(this);
203 
204  if (m_opaque_ptr->m_shell.empty())
205  return nullptr;
206  return m_opaque_ptr->m_shell.c_str();
207 }
208 
209 void SBPlatformShellCommand::SetShell(const char *shell_interpreter) {
210  LLDB_INSTRUMENT_VA(this, shell_interpreter);
211 
212  if (shell_interpreter && shell_interpreter[0])
213  m_opaque_ptr->m_shell = shell_interpreter;
214  else
215  m_opaque_ptr->m_shell.clear();
216 }
217 
219  LLDB_INSTRUMENT_VA(this);
220 
221  if (m_opaque_ptr->m_command.empty())
222  return nullptr;
223  return m_opaque_ptr->m_command.c_str();
224 }
225 
226 void SBPlatformShellCommand::SetCommand(const char *shell_command) {
227  LLDB_INSTRUMENT_VA(this, shell_command);
228 
229  if (shell_command && shell_command[0])
230  m_opaque_ptr->m_command = shell_command;
231  else
232  m_opaque_ptr->m_command.clear();
233 }
234 
236  LLDB_INSTRUMENT_VA(this);
237 
238  if (m_opaque_ptr->m_working_dir.empty())
239  return nullptr;
240  return m_opaque_ptr->m_working_dir.c_str();
241 }
242 
244  LLDB_INSTRUMENT_VA(this, path);
245 
246  if (path && path[0])
247  m_opaque_ptr->m_working_dir = path;
248  else
249  m_opaque_ptr->m_working_dir.clear();
250 }
251 
253  LLDB_INSTRUMENT_VA(this);
254 
255  if (m_opaque_ptr->m_timeout)
256  return m_opaque_ptr->m_timeout->count();
257  return UINT32_MAX;
258 }
259 
261  LLDB_INSTRUMENT_VA(this, sec);
262 
263  if (sec == UINT32_MAX)
264  m_opaque_ptr->m_timeout = llvm::None;
265  else
266  m_opaque_ptr->m_timeout = std::chrono::seconds(sec);
267 }
268 
270  LLDB_INSTRUMENT_VA(this);
271 
272  return m_opaque_ptr->m_signo;
273 }
274 
276  LLDB_INSTRUMENT_VA(this);
277 
278  return m_opaque_ptr->m_status;
279 }
280 
282  LLDB_INSTRUMENT_VA(this);
283 
284  if (m_opaque_ptr->m_output.empty())
285  return nullptr;
286  return m_opaque_ptr->m_output.c_str();
287 }
288 
289 // SBPlatform
291 
292 SBPlatform::SBPlatform(const char *platform_name) {
293  LLDB_INSTRUMENT_VA(this, platform_name);
294 
295  m_opaque_sp = Platform::Create(platform_name);
296 }
297 
299  LLDB_INSTRUMENT_VA(this, rhs);
300 
301  m_opaque_sp = rhs.m_opaque_sp;
302 }
303 
305  LLDB_INSTRUMENT_VA(this, rhs);
306 
307  m_opaque_sp = rhs.m_opaque_sp;
308  return *this;
309 }
310 
311 SBPlatform::~SBPlatform() = default;
312 
314  LLDB_INSTRUMENT();
315 
316  SBPlatform host_platform;
317  host_platform.m_opaque_sp = Platform::GetHostPlatform();
318  return host_platform;
319 }
320 
321 bool SBPlatform::IsValid() const {
322  LLDB_INSTRUMENT_VA(this);
323  return this->operator bool();
324 }
325 SBPlatform::operator bool() const {
326  LLDB_INSTRUMENT_VA(this);
327 
328  return m_opaque_sp.get() != nullptr;
329 }
330 
332  LLDB_INSTRUMENT_VA(this);
333 
334  m_opaque_sp.reset();
335 }
336 
337 const char *SBPlatform::GetName() {
338  LLDB_INSTRUMENT_VA(this);
339 
340  PlatformSP platform_sp(GetSP());
341  if (platform_sp)
342  return ConstString(platform_sp->GetName()).AsCString();
343  return nullptr;
344 }
345 
346 lldb::PlatformSP SBPlatform::GetSP() const { return m_opaque_sp; }
347 
348 void SBPlatform::SetSP(const lldb::PlatformSP &platform_sp) {
349  m_opaque_sp = platform_sp;
350 }
351 
353  LLDB_INSTRUMENT_VA(this);
354 
355  PlatformSP platform_sp(GetSP());
356  if (platform_sp)
357  return platform_sp->GetWorkingDirectory().GetCString();
358  return nullptr;
359 }
360 
361 bool SBPlatform::SetWorkingDirectory(const char *path) {
362  LLDB_INSTRUMENT_VA(this, path);
363 
364  PlatformSP platform_sp(GetSP());
365  if (platform_sp) {
366  if (path)
367  platform_sp->SetWorkingDirectory(FileSpec(path));
368  else
369  platform_sp->SetWorkingDirectory(FileSpec());
370  return true;
371  }
372  return false;
373 }
374 
376  LLDB_INSTRUMENT_VA(this, connect_options);
377 
378  SBError sb_error;
379  PlatformSP platform_sp(GetSP());
380  if (platform_sp && connect_options.GetURL()) {
381  Args args;
382  args.AppendArgument(connect_options.GetURL());
383  sb_error.ref() = platform_sp->ConnectRemote(args);
384  } else {
385  sb_error.SetErrorString("invalid platform");
386  }
387  return sb_error;
388 }
389 
391  LLDB_INSTRUMENT_VA(this);
392 
393  PlatformSP platform_sp(GetSP());
394  if (platform_sp)
395  platform_sp->DisconnectRemote();
396 }
397 
399  LLDB_INSTRUMENT_VA(this);
400 
401  PlatformSP platform_sp(GetSP());
402  if (platform_sp)
403  return platform_sp->IsConnected();
404  return false;
405 }
406 
407 const char *SBPlatform::GetTriple() {
408  LLDB_INSTRUMENT_VA(this);
409 
410  PlatformSP platform_sp(GetSP());
411  if (platform_sp) {
412  ArchSpec arch(platform_sp->GetSystemArchitecture());
413  if (arch.IsValid()) {
414  // Const-ify the string so we don't need to worry about the lifetime of
415  // the string
416  return ConstString(arch.GetTriple().getTriple().c_str()).GetCString();
417  }
418  }
419  return nullptr;
420 }
421 
422 const char *SBPlatform::GetOSBuild() {
423  LLDB_INSTRUMENT_VA(this);
424 
425  PlatformSP platform_sp(GetSP());
426  if (platform_sp) {
427  std::string s = platform_sp->GetOSBuildString().getValueOr("");
428  if (!s.empty()) {
429  // Const-ify the string so we don't need to worry about the lifetime of
430  // the string
431  return ConstString(s).GetCString();
432  }
433  }
434  return nullptr;
435 }
436 
438  LLDB_INSTRUMENT_VA(this);
439 
440  PlatformSP platform_sp(GetSP());
441  if (platform_sp) {
442  std::string s = platform_sp->GetOSKernelDescription().getValueOr("");
443  if (!s.empty()) {
444  // Const-ify the string so we don't need to worry about the lifetime of
445  // the string
446  return ConstString(s.c_str()).GetCString();
447  }
448  }
449  return nullptr;
450 }
451 
452 const char *SBPlatform::GetHostname() {
453  LLDB_INSTRUMENT_VA(this);
454 
455  PlatformSP platform_sp(GetSP());
456  if (platform_sp)
457  return platform_sp->GetHostname();
458  return nullptr;
459 }
460 
462  LLDB_INSTRUMENT_VA(this);
463 
464  llvm::VersionTuple version;
465  if (PlatformSP platform_sp = GetSP())
466  version = platform_sp->GetOSVersion();
467  return version.empty() ? UINT32_MAX : version.getMajor();
468 }
469 
471  LLDB_INSTRUMENT_VA(this);
472 
473  llvm::VersionTuple version;
474  if (PlatformSP platform_sp = GetSP())
475  version = platform_sp->GetOSVersion();
476  return version.getMinor().getValueOr(UINT32_MAX);
477 }
478 
480  LLDB_INSTRUMENT_VA(this);
481 
482  llvm::VersionTuple version;
483  if (PlatformSP platform_sp = GetSP())
484  version = platform_sp->GetOSVersion();
485  return version.getSubminor().getValueOr(UINT32_MAX);
486 }
487 
488 void SBPlatform::SetSDKRoot(const char *sysroot) {
489  LLDB_INSTRUMENT_VA(this, sysroot);
490  if (PlatformSP platform_sp = GetSP())
491  platform_sp->SetSDKRootDirectory(ConstString(sysroot));
492 }
493 
495  LLDB_INSTRUMENT_VA(this, src, dst);
496 
497  SBError sb_error;
498  PlatformSP platform_sp(GetSP());
499  if (platform_sp) {
500  sb_error.ref() = platform_sp->GetFile(src.ref(), dst.ref());
501  } else {
502  sb_error.SetErrorString("invalid platform");
503  }
504  return sb_error;
505 }
506 
508  LLDB_INSTRUMENT_VA(this, src, dst);
509  return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
510  if (src.Exists()) {
511  uint32_t permissions = FileSystem::Instance().GetPermissions(src.ref());
512  if (permissions == 0) {
513  if (FileSystem::Instance().IsDirectory(src.ref()))
514  permissions = eFilePermissionsDirectoryDefault;
515  else
516  permissions = eFilePermissionsFileDefault;
517  }
518 
519  return platform_sp->PutFile(src.ref(), dst.ref(), permissions);
520  }
521 
522  Status error;
523  error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
524  src.ref().GetPath().c_str());
525  return error;
526  });
527 }
528 
529 SBError SBPlatform::Install(SBFileSpec &src, SBFileSpec &dst) {
530  LLDB_INSTRUMENT_VA(this, src, dst);
531  return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
532  if (src.Exists())
533  return platform_sp->Install(src.ref(), dst.ref());
534 
535  Status error;
536  error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'",
537  src.ref().GetPath().c_str());
538  return error;
539  });
540 }
541 
543  LLDB_INSTRUMENT_VA(this, shell_command);
544  return ExecuteConnected(
545  [&](const lldb::PlatformSP &platform_sp) {
546  const char *command = shell_command.GetCommand();
547  if (!command)
548  return Status("invalid shell command (empty)");
549 
550  const char *working_dir = shell_command.GetWorkingDirectory();
551  if (working_dir == nullptr) {
552  working_dir = platform_sp->GetWorkingDirectory().GetCString();
553  if (working_dir)
554  shell_command.SetWorkingDirectory(working_dir);
555  }
556  return platform_sp->RunShellCommand(
557  shell_command.m_opaque_ptr->m_shell, command, FileSpec(working_dir),
558  &shell_command.m_opaque_ptr->m_status,
559  &shell_command.m_opaque_ptr->m_signo,
560  &shell_command.m_opaque_ptr->m_output,
561  shell_command.m_opaque_ptr->m_timeout);
562  });
563 }
564 
566  LLDB_INSTRUMENT_VA(this, launch_info);
567  return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
568  ProcessLaunchInfo info = launch_info.ref();
569  Status error = platform_sp->LaunchProcess(info);
570  launch_info.set_ref(info);
571  return error;
572  });
573 }
574 
576  LLDB_INSTRUMENT_VA(this, pid);
577  return ExecuteConnected([&](const lldb::PlatformSP &platform_sp) {
578  return platform_sp->KillProcess(pid);
579  });
580 }
581 
583  const std::function<Status(const lldb::PlatformSP &)> &func) {
584  SBError sb_error;
585  const auto platform_sp(GetSP());
586  if (platform_sp) {
587  if (platform_sp->IsConnected())
588  sb_error.ref() = func(platform_sp);
589  else
590  sb_error.SetErrorString("not connected");
591  } else
592  sb_error.SetErrorString("invalid platform");
593 
594  return sb_error;
595 }
596 
597 SBError SBPlatform::MakeDirectory(const char *path, uint32_t file_permissions) {
598  LLDB_INSTRUMENT_VA(this, path, file_permissions);
599 
600  SBError sb_error;
601  PlatformSP platform_sp(GetSP());
602  if (platform_sp) {
603  sb_error.ref() =
604  platform_sp->MakeDirectory(FileSpec(path), file_permissions);
605  } else {
606  sb_error.SetErrorString("invalid platform");
607  }
608  return sb_error;
609 }
610 
612  LLDB_INSTRUMENT_VA(this, path);
613 
614  PlatformSP platform_sp(GetSP());
615  if (platform_sp) {
616  uint32_t file_permissions = 0;
617  platform_sp->GetFilePermissions(FileSpec(path), file_permissions);
618  return file_permissions;
619  }
620  return 0;
621 }
622 
624  uint32_t file_permissions) {
625  LLDB_INSTRUMENT_VA(this, path, file_permissions);
626 
627  SBError sb_error;
628  PlatformSP platform_sp(GetSP());
629  if (platform_sp) {
630  sb_error.ref() =
631  platform_sp->SetFilePermissions(FileSpec(path), file_permissions);
632  } else {
633  sb_error.SetErrorString("invalid platform");
634  }
635  return sb_error;
636 }
637 
639  LLDB_INSTRUMENT_VA(this);
640 
641  if (auto platform_sp = GetSP())
642  return SBUnixSignals{platform_sp};
643 
644  return SBUnixSignals();
645 }
646 
648  LLDB_INSTRUMENT_VA(this);
649  PlatformSP platform_sp(GetSP());
650 
651  if (platform_sp) {
652  return SBEnvironment(platform_sp->GetEnvironment());
653  }
654 
655  return SBEnvironment();
656 }
lldb::SBPlatformShellCommand::SetWorkingDirectory
void SetWorkingDirectory(const char *path)
Definition: SBPlatform.cpp:243
Instrumentation.h
lldb::SBPlatform::ExecuteConnected
SBError ExecuteConnected(const std::function< lldb_private::Status(const lldb::PlatformSP &)> &func)
Definition: SBPlatform.cpp:582
lldb::SBLaunchInfo
Definition: SBLaunchInfo.h:23
lldb::SBPlatformShellCommand::GetShell
const char * GetShell()
Definition: SBPlatform.cpp:201
lldb::SBPlatform::GetHostPlatform
static SBPlatform GetHostPlatform()
Definition: SBPlatform.cpp:313
PlatformShellCommand::m_shell
std::string m_shell
Definition: SBPlatform.cpp:66
lldb::SBPlatform::SetSDKRoot
void SetSDKRoot(const char *sysroot)
Definition: SBPlatform.cpp:488
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb::SBPlatformConnectOptions::SBPlatformConnectOptions
SBPlatformConnectOptions(const char *url)
Definition: SBPlatform.cpp:75
lldb::SBPlatform::~SBPlatform
~SBPlatform()
PlatformShellCommand::PlatformShellCommand
PlatformShellCommand(llvm::StringRef shell_command=llvm::StringRef())
Definition: SBPlatform.cpp:59
lldb::SBPlatformShellCommand::~SBPlatformShellCommand
~SBPlatformShellCommand()
Definition: SBPlatform.cpp:191
SBLaunchInfo.h
lldb::SBError
Definition: SBError.h:20
PlatformShellCommand::m_status
int m_status
Definition: SBPlatform.cpp:70
PlatformConnectOptions::m_rsync_enabled
bool m_rsync_enabled
Definition: SBPlatform.cpp:43
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:269
lldb::SBPlatformShellCommand::SetCommand
void SetCommand(const char *shell_command)
Definition: SBPlatform.cpp:226
lldb::SBPlatformShellCommand::SetTimeoutSeconds
void SetTimeoutSeconds(uint32_t sec)
Definition: SBPlatform.cpp:260
PlatformConnectOptions::m_local_cache_directory
ConstString m_local_cache_directory
Definition: SBPlatform.cpp:45
lldb::SBPlatform::GetUnixSignals
SBUnixSignals GetUnixSignals() const
Definition: SBPlatform.cpp:638
lldb::SBEnvironment
class LLDB_API SBEnvironment
Definition: SBDefines.h:51
lldb_private::ConstString::SetCString
void SetCString(const char *cstr)
Set the C string value.
Definition: ConstString.cpp:301
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_INSTRUMENT
#define LLDB_INSTRUMENT()
Definition: Instrumentation.h:95
lldb::SBPlatform::GetOSUpdateVersion
uint32_t GetOSUpdateVersion()
Definition: SBPlatform.cpp:479
lldb_private::Args
Definition: Args.h:33
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:455
lldb::SBPlatform::GetName
const char * GetName()
Definition: SBPlatform.cpp:337
lldb::SBPlatform::m_opaque_sp
lldb::PlatformSP m_opaque_sp
Definition: SBPlatform.h:184
Target.h
lldb::SBPlatform::SetWorkingDirectory
bool SetWorkingDirectory(const char *path)
Definition: SBPlatform.cpp:361
lldb::SBPlatform::Run
SBError Run(SBPlatformShellCommand &shell_command)
Definition: SBPlatform.cpp:542
Platform.h
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb::SBPlatformConnectOptions::operator=
SBPlatformConnectOptions & operator=(const SBPlatformConnectOptions &rhs)
Definition: SBPlatform.cpp:91
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
PlatformShellCommand::m_command
std::string m_command
Definition: SBPlatform.cpp:67
PlatformConnectOptions::m_rsync_remote_path_prefix
std::string m_rsync_remote_path_prefix
Definition: SBPlatform.cpp:42
lldb::SBPlatformConnectOptions::~SBPlatformConnectOptions
~SBPlatformConnectOptions()
Definition: SBPlatform.cpp:88
PlatformConnectOptions::m_rsync_omit_hostname_from_remote_path
bool m_rsync_omit_hostname_from_remote_path
Definition: SBPlatform.cpp:44
lldb_private::ProcessLaunchInfo
Definition: ProcessLaunchInfo.h:31
lldb::SBPlatform::IsConnected
bool IsConnected()
Definition: SBPlatform.cpp:398
Args.h
lldb::SBPlatformShellCommand::GetOutput
const char * GetOutput()
Definition: SBPlatform.cpp:281
PlatformShellCommand::m_working_dir
std::string m_working_dir
Definition: SBPlatform.cpp:68
lldb::SBPlatform::GetSP
lldb::PlatformSP GetSP() const
Definition: SBPlatform.cpp:346
SBFileSpec.h
lldb::SBPlatform::Put
SBError Put(SBFileSpec &src, SBFileSpec &dst)
Definition: SBPlatform.cpp:507
lldb::SBPlatform::GetEnvironment
SBEnvironment GetEnvironment()
Return the environment variables of the remote platform connection process.
Definition: SBPlatform.cpp:647
lldb::SBPlatform::DisconnectRemote
void DisconnectRemote()
Definition: SBPlatform.cpp:390
lldb::SBPlatform::operator=
SBPlatform & operator=(const SBPlatform &rhs)
Definition: SBPlatform.cpp:304
lldb::SBPlatformConnectOptions
Definition: SBPlatform.h:23
lldb_private::ConstString
Definition: ConstString.h:40
lldb::SBPlatform::SBPlatform
SBPlatform()
Definition: SBPlatform.cpp:290
lldb::SBError::SetErrorString
void SetErrorString(const char *err_str)
Definition: SBError.cpp:121
lldb::SBFileSpec::ref
const lldb_private::FileSpec & ref() const
Definition: SBFileSpec.cpp:162
lldb::SBPlatform::ConnectRemote
SBError ConnectRemote(SBPlatformConnectOptions &connect_options)
Definition: SBPlatform.cpp:375
lldb::SBEnvironment
Definition: SBEnvironment.h:16
lldb::SBPlatform::GetHostname
const char * GetHostname()
Definition: SBPlatform.cpp:452
PlatformShellCommand::m_output
std::string m_output
Definition: SBPlatform.cpp:69
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:353
lldb::SBPlatformConnectOptions::DisableRsync
void DisableRsync()
Definition: SBPlatform.cpp:141
lldb::SBPlatformConnectOptions::GetRsyncEnabled
bool GetRsyncEnabled()
Definition: SBPlatform.cpp:115
lldb::SBPlatformShellCommand::Clear
void Clear()
Definition: SBPlatform.cpp:193
lldb::SBPlatformConnectOptions::SetLocalCacheDirectory
void SetLocalCacheDirectory(const char *path)
Definition: SBPlatform.cpp:153
lldb::SBPlatform::GetOSDescription
const char * GetOSDescription()
Definition: SBPlatform.cpp:437
lldb::SBPlatformConnectOptions::SetURL
void SetURL(const char *url)
Definition: SBPlatform.cpp:106
lldb::SBPlatform::IsValid
bool IsValid() const
Definition: SBPlatform.cpp:321
lldb::SBPlatform::GetOSMajorVersion
uint32_t GetOSMajorVersion()
Definition: SBPlatform.cpp:461
lldb::SBPlatformShellCommand::SBPlatformShellCommand
SBPlatformShellCommand(const char *shell, const char *shell_command)
Definition: SBPlatform.cpp:163
lldb::SBPlatformShellCommand::GetTimeoutSeconds
uint32_t GetTimeoutSeconds()
Definition: SBPlatform.cpp:252
lldb::SBPlatform::SetFilePermissions
SBError SetFilePermissions(const char *path, uint32_t file_permissions)
Definition: SBPlatform.cpp:623
lldb::SBPlatformConnectOptions::GetURL
const char * GetURL()
Definition: SBPlatform.cpp:98
lldb_private::Status
Definition: Status.h:44
PlatformShellCommand
Definition: SBPlatform.cpp:49
lldb_private::Timeout
Definition: Connection.h:25
lldb::SBPlatform::Clear
void Clear()
Definition: SBPlatform.cpp:331
lldb::SBUnixSignals
class LLDB_API SBUnixSignals
Definition: SBDefines.h:107
PlatformConnectOptions::m_url
std::string m_url
Definition: SBPlatform.cpp:40
lldb::SBLaunchInfo::ref
const lldb_private::ProcessLaunchInfo & ref() const
Definition: SBLaunchInfo.cpp:65
uint32_t
lldb::SBPlatform::SetSP
void SetSP(const lldb::PlatformSP &platform_sp)
Definition: SBPlatform.cpp:348
PlatformConnectOptions::m_rsync_options
std::string m_rsync_options
Definition: SBPlatform.cpp:41
lldb::SBPlatform::Kill
SBError Kill(const lldb::pid_t pid)
Definition: SBPlatform.cpp:575
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:597
lldb::SBPlatformShellCommand::SetShell
void SetShell(const char *shell)
Definition: SBPlatform.cpp:209
lldb::SBPlatformShellCommand::GetCommand
const char * GetCommand()
Definition: SBPlatform.cpp:218
lldb::SBPlatform::GetFilePermissions
uint32_t GetFilePermissions(const char *path)
Definition: SBPlatform.cpp:611
ArchSpec.h
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb::SBLaunchInfo::set_ref
void set_ref(const lldb_private::ProcessLaunchInfo &info)
Definition: SBLaunchInfo.cpp:69
lldb::SBPlatform::GetOSBuild
const char * GetOSBuild()
Definition: SBPlatform.cpp:422
lldb::SBPlatform::GetOSMinorVersion
uint32_t GetOSMinorVersion()
Definition: SBPlatform.cpp:470
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:494
lldb::SBFileSpec
Definition: SBFileSpec.h:16
lldb::SBFileSpec::Exists
bool Exists() const
Definition: SBFileSpec.cpp:86
SBEnvironment.h
Status.h
lldb::SBError::ref
lldb_private::Status & ref()
Definition: SBError.cpp:156
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:72
lldb::SBPlatformConnectOptions::GetLocalCacheDirectory
const char * GetLocalCacheDirectory()
Definition: SBPlatform.cpp:147
SBUnixSignals.h
LLDB_INSTRUMENT_VA
#define LLDB_INSTRUMENT_VA(...)
Definition: Instrumentation.h:98
lldb::SBPlatformShellCommand::GetWorkingDirectory
const char * GetWorkingDirectory()
Definition: SBPlatform.cpp:235
lldb::SBPlatform::GetTriple
const char * GetTriple()
Definition: SBPlatform.cpp:407
lldb::SBPlatformShellCommand::operator=
SBPlatformShellCommand & operator=(const SBPlatformShellCommand &rhs)
Definition: SBPlatform.cpp:183
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:121
PlatformShellCommand::m_signo
int m_signo
Definition: SBPlatform.cpp:71
lldb_private::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:347
lldb::SBPlatform
Definition: SBPlatform.h:93
lldb::SBPlatform::Launch
SBError Launch(SBLaunchInfo &launch_info)
Definition: SBPlatform.cpp:565
lldb
Definition: SBAddress.h:15
File.h
lldb::SBPlatformShellCommand::GetStatus
int GetStatus()
Definition: SBPlatform.cpp:275
lldb::SBPlatform::GetWorkingDirectory
const char * GetWorkingDirectory()
Definition: SBPlatform.cpp:352
SBError.h
lldb::SBUnixSignals
Definition: SBUnixSignals.h:17
SBPlatform.h
PlatformShellCommand::PlatformShellCommand
PlatformShellCommand(llvm::StringRef shell_interpreter, llvm::StringRef shell_command)
Definition: SBPlatform.cpp:50