LLDB
mainline
llvm-project
lldb
include
lldb
API
SBPlatform.h
Go to the documentation of this file.
1
//===-- SBPlatform.h --------------------------------------------*- C++ -*-===//
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
#ifndef LLDB_API_SBPLATFORM_H
10
#define LLDB_API_SBPLATFORM_H
11
12
#include "
lldb/API/SBDefines.h
"
13
#include "
lldb/API/SBProcess.h
"
14
#include "
lldb/API/SBProcessInfoList.h
"
15
16
#include <functional>
17
18
struct
PlatformConnectOptions
;
19
struct
PlatformShellCommand
;
20
class
ProcessInstanceInfoMatch;
21
22
namespace
lldb
{
23
24
class
SBAttachInfo
;
25
class
SBLaunchInfo
;
26
27
class
LLDB_API
SBPlatformConnectOptions
{
28
public
:
29
SBPlatformConnectOptions
(
const
char
*url);
30
31
SBPlatformConnectOptions
(
const
SBPlatformConnectOptions
&rhs);
32
33
~SBPlatformConnectOptions
();
34
35
SBPlatformConnectOptions
&operator=(
const
SBPlatformConnectOptions
&rhs);
36
37
const
char
*GetURL();
38
39
void
SetURL(
const
char
*url);
40
41
bool
GetRsyncEnabled();
42
43
void
EnableRsync(
const
char
*options,
const
char
*remote_path_prefix,
44
bool
omit_remote_hostname);
45
46
void
DisableRsync();
47
48
const
char
*GetLocalCacheDirectory();
49
50
void
SetLocalCacheDirectory(
const
char
*path);
51
52
protected
:
53
PlatformConnectOptions
*
m_opaque_ptr
;
54
};
55
56
class
LLDB_API
SBPlatformShellCommand
{
57
public
:
58
SBPlatformShellCommand
(
const
char
*shell,
const
char
*shell_command);
59
SBPlatformShellCommand
(
const
char
*shell_command);
60
61
SBPlatformShellCommand
(
const
SBPlatformShellCommand
&rhs);
62
63
SBPlatformShellCommand
&operator=(
const
SBPlatformShellCommand
&rhs);
64
65
~SBPlatformShellCommand
();
66
67
void
Clear();
68
69
const
char
*GetShell();
70
71
void
SetShell(
const
char
*shell);
72
73
const
char
*GetCommand();
74
75
void
SetCommand(
const
char
*shell_command);
76
77
const
char
*GetWorkingDirectory();
78
79
void
SetWorkingDirectory(
const
char
*path);
80
81
uint32_t GetTimeoutSeconds();
82
83
void
SetTimeoutSeconds(uint32_t sec);
84
85
int
GetSignal();
86
87
int
GetStatus();
88
89
const
char
*GetOutput();
90
91
protected
:
92
friend
class
SBPlatform
;
93
94
PlatformShellCommand
*
m_opaque_ptr
;
95
};
96
97
class
LLDB_API
SBPlatform
{
98
public
:
99
SBPlatform
();
100
101
SBPlatform
(
const
char
*platform_name);
102
103
SBPlatform
(
const
SBPlatform
&rhs);
104
105
SBPlatform
&operator=(
const
SBPlatform
&rhs);
106
107
~SBPlatform
();
108
109
static
SBPlatform
GetHostPlatform();
110
111
explicit
operator
bool()
const
;
112
113
bool
IsValid()
const
;
114
115
void
Clear();
116
117
const
char
*GetWorkingDirectory();
118
119
bool
SetWorkingDirectory(
const
char
*path);
120
121
const
char
*
GetName
();
122
123
SBError
ConnectRemote(
SBPlatformConnectOptions
&connect_options);
124
125
void
DisconnectRemote();
126
127
bool
IsConnected();
128
129
// The following functions will work if the platform is connected
130
const
char
*GetTriple();
131
132
const
char
*GetHostname();
133
134
const
char
*GetOSBuild();
135
136
const
char
*GetOSDescription();
137
138
uint32_t GetOSMajorVersion();
139
140
uint32_t GetOSMinorVersion();
141
142
uint32_t GetOSUpdateVersion();
143
144
void
SetSDKRoot(
const
char
*sysroot);
145
146
SBError
Put(
SBFileSpec
&src,
SBFileSpec
&dst);
147
148
SBError
Get(
SBFileSpec
&src,
SBFileSpec
&dst);
149
150
SBError
Install(
SBFileSpec
&src,
SBFileSpec
&dst);
151
152
SBError
Run(
SBPlatformShellCommand
&shell_command);
153
154
SBError
Launch(
SBLaunchInfo
&launch_info);
155
156
SBProcess
Attach(
SBAttachInfo
&attach_info,
const
SBDebugger
&debugger,
157
SBTarget
&target,
SBError
&
error
);
158
159
SBProcessInfoList
GetAllProcesses(
SBError
&
error
);
160
161
SBError
Kill(
const
lldb::pid_t
pid);
162
163
SBError
164
MakeDirectory(
const
char
*path,
165
uint32_t file_permissions = eFilePermissionsDirectoryDefault);
166
167
uint32_t GetFilePermissions(
const
char
*path);
168
169
SBError
SetFilePermissions(
const
char
*path, uint32_t file_permissions);
170
171
SBUnixSignals
GetUnixSignals()
const
;
172
173
/// Return the environment variables of the remote platform connection
174
/// process.
175
///
176
/// \return
177
/// An lldb::SBEnvironment object which is a copy of the platform's
178
/// environment.
179
SBEnvironment
GetEnvironment();
180
181
/// Set a callback as an implementation for locating module in order to
182
/// implement own module cache system. For example, to leverage distributed
183
/// build system, to bypass pulling files from remote platform, or to search
184
/// symbol files from symbol servers. The target will call this callback to
185
/// get a module file and a symbol file, and it will fallback to the LLDB
186
/// implementation when this callback failed or returned non-existent file.
187
/// This callback can set either module_file_spec or symbol_file_spec, or both
188
/// module_file_spec and symbol_file_spec. The callback will be cleared if
189
/// nullptr or None is set.
190
SBError
SetLocateModuleCallback(
lldb::SBPlatformLocateModuleCallback
callback,
191
void
*callback_baton);
192
193
protected
:
194
friend
class
SBDebugger
;
195
friend
class
SBTarget
;
196
197
lldb::PlatformSP
GetSP()
const
;
198
199
void
SetSP(
const
lldb::PlatformSP
&platform_sp);
200
201
SBError
ExecuteConnected(
202
const
std::function<
lldb_private::Status
(
const
lldb::PlatformSP
&)>
203
&func);
204
205
lldb::PlatformSP
m_opaque_sp
;
206
};
207
208
}
// namespace lldb
209
210
#endif
// LLDB_API_SBPLATFORM_H
error
static llvm::raw_ostream & error(Stream &strm)
Definition:
CommandReturnObject.cpp:17
GetName
static const char * GetName(DWARFDeclContext::Entry entry)
Returns the name of entry if it has one, or the appropriate "anonymous {namespace,...
Definition:
DWARFDeclContext.cpp:17
SBDefines.h
LLDB_API
#define LLDB_API
Definition:
SBDefines.h:28
SBProcessInfoList.h
SBProcess.h
lldb::SBAttachInfo
Definition:
SBAttachInfo.h:22
lldb::SBDebugger
Definition:
SBDebugger.h:43
lldb::SBEnvironment
Definition:
SBEnvironment.h:16
lldb::SBError
Definition:
SBError.h:23
lldb::SBFileSpec
Definition:
SBFileSpec.h:16
lldb::SBLaunchInfo
Definition:
SBLaunchInfo.h:24
lldb::SBPlatformConnectOptions
Definition:
SBPlatform.h:27
lldb::SBPlatformConnectOptions::m_opaque_ptr
PlatformConnectOptions * m_opaque_ptr
Definition:
SBPlatform.h:53
lldb::SBPlatformShellCommand
Definition:
SBPlatform.h:56
lldb::SBPlatformShellCommand::m_opaque_ptr
PlatformShellCommand * m_opaque_ptr
Definition:
SBPlatform.h:94
lldb::SBPlatform
Definition:
SBPlatform.h:97
lldb::SBPlatform::~SBPlatform
~SBPlatform()
lldb::SBPlatform::m_opaque_sp
lldb::PlatformSP m_opaque_sp
Definition:
SBPlatform.h:205
lldb::SBProcessInfoList
Definition:
SBProcessInfoList.h:22
lldb::SBProcess
Definition:
SBProcess.h:29
lldb::SBTarget
Definition:
SBTarget.h:37
lldb::SBUnixSignals
Definition:
SBUnixSignals.h:17
lldb_private::Status
An error handling class.
Definition:
Status.h:44
lldb
Definition:
SBAddress.h:15
lldb::PlatformSP
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition:
lldb-forward.h:380
lldb::SBAttachInfo
class LLDB_API SBAttachInfo
Definition:
SBDefines.h:46
lldb::pid_t
uint64_t pid_t
Definition:
lldb-types.h:81
lldb::SBPlatformLocateModuleCallback
SBError(* SBPlatformLocateModuleCallback)(void *baton, const SBModuleSpec &module_spec, SBFileSpec &module_file_spec, SBFileSpec &symbol_file_spec)
Definition:
SBDefines.h:142
lldb::SBLaunchInfo
class LLDB_API SBLaunchInfo
Definition:
SBDefines.h:81
PlatformConnectOptions
Definition:
SBPlatform.cpp:36
PlatformShellCommand
Definition:
SBPlatform.cpp:53
Generated on Thu Apr 18 2024 08:21:17 for LLDB by
1.9.6