33 : m_debugger(debugger), m_script_lang(script_lang),
34 m_scripted_platform_interface_up(
35 std::move(scripted_platform_interface_up)) {}
38 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
41 "This script interpreter does not support breakpoint callbacks.");
47 "This script interpreter does not support watchpoint callbacks.");
60 "This script interpreter does not support importing modules.");
75 llvm_unreachable(
"Unhandled ScriptInterpreter!");
95 return std::make_shared<ProcessLaunchInfo>(
101 if (
error.m_opaque_up)
102 return *
error.m_opaque_up;
107std::optional<MemoryRegionInfo>
127 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
128 const char *callback_text) {
133 if (!
error.Success())
140 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
146 if (!
error.Success())
152std::unique_ptr<ScriptInterpreterLocker>
154 return std::make_unique<ScriptInterpreterLocker>();
159 if (src && src_len) {
161 strm->
Write(src, src_len);
166llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>>
170 return std::unique_ptr<ScriptInterpreterIORedirect>(
176 return nullin.takeError();
181 return nullin.takeError();
183 return std::unique_ptr<ScriptInterpreterIORedirect>(
188 std::unique_ptr<File> input, std::unique_ptr<File> output)
189 : m_input_file_sp(std::move(input)),
190 m_output_file_sp(std::make_shared<
StreamFile>(std::move(output))),
191 m_error_file_sp(m_output_file_sp),
192 m_communication(
"lldb.ScriptInterpreterIORedirect.comm"),
193 m_disconnect(false) {}
197 : m_communication(
"lldb.ScriptInterpreterIORedirect.comm"),
198 m_disconnect(false) {
208 std::unique_ptr<ConnectionGenericFile> conn_up =
209 std::make_unique<ConnectionGenericFile>(read_file,
true);
211 std::unique_ptr<ConnectionFileDescriptor> conn_up =
212 std::make_unique<ConnectionFileDescriptor>(
216 if (conn_up->IsConnected()) {
227 ::setbuf(outfile_handle,
nullptr);
static llvm::raw_ostream & error(Stream &strm)
static void ReadThreadBytesReceived(void *baton, const void *src, size_t src_len)
ProcessAttachInfoSP m_opaque_sp
lldb::BreakpointWP m_opaque_wp
lldb::DataExtractorSP m_opaque_sp
std::shared_ptr< lldb_private::SBLaunchInfoImpl > m_opaque_sp
lldb::MemoryRegionInfoUP m_opaque_up
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
void SetImmediateErrorFile(lldb::FileSP file_sp)
void void AppendError(llvm::StringRef in_string)
void SetImmediateOutputFile(lldb::FileSP file_sp)
Stream & GetOutputStream()
A class to manage flag bits.
StreamFile & GetOutputStream()
lldb::FileSP GetInputFileSP()
StreamFile & GetErrorStream()
void AdoptTopIOHandlerFilesIfInvalid(lldb::FileSP &in, lldb::StreamFileSP &out, lldb::StreamFileSP &err)
static const char * DEV_NULL
int Open(const char *path, int flags, int mode=0600)
Wraps ::open in a platform-independent way.
static FileSystem & Instance()
A posix-based implementation of Pipe, a class that abtracts unix style pipes.
int ReleaseReadFileDescriptor() override
int ReleaseWriteFileDescriptor() override
Status CreateNew(bool child_process_inherit) override
lldb::StreamFileSP m_error_file_sp
lldb::FileSP m_input_file_sp
ThreadedCommunication m_communication
lldb::StreamFileSP m_output_file_sp
~ScriptInterpreterIORedirect()
void Flush()
Flush our output and error file handles.
ScriptInterpreterIORedirect(std::unique_ptr< File > input, std::unique_ptr< File > output)
static llvm::Expected< std::unique_ptr< ScriptInterpreterIORedirect > > Create(bool enable_io, Debugger &debugger, CommandReturnObject *result)
Create an IO redirect.
static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string)
virtual void CollectDataForBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &options, CommandReturnObject &result)
lldb::ProcessAttachInfoSP GetOpaqueTypeFromSBAttachInfo(const lldb::SBAttachInfo &attach_info) const
virtual bool LoadScriptingModule(const char *filename, const LoadScriptOptions &options, lldb_private::Status &error, StructuredData::ObjectSP *module_sp=nullptr, FileSpec extra_search_dir={})
Status SetBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, const char *callback_text)
Set the specified text as the callback for the breakpoint.
lldb::ProcessLaunchInfoSP GetOpaqueTypeFromSBLaunchInfo(const lldb::SBLaunchInfo &launch_info) const
static std::string LanguageToString(lldb::ScriptLanguage language)
Status GetStatusFromSBError(const lldb::SBError &error) const
std::optional< MemoryRegionInfo > GetOpaqueTypeFromSBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &mem_region) const
virtual std::unique_ptr< ScriptInterpreterLocker > AcquireInterpreterLock()
virtual StructuredData::DictionarySP GetInterpreterInfo()
Status SetBreakpointCommandCallbackFunction(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, const char *function_name, StructuredData::ObjectSP extra_args_sp)
lldb::BreakpointSP GetOpaqueTypeFromSBBreakpoint(const lldb::SBBreakpoint &breakpoint) const
lldb::DataExtractorSP GetDataExtractorFromSBData(const lldb::SBData &data) const
virtual void CollectDataForWatchpointCommandCallback(WatchpointOptions *wp_options, CommandReturnObject &result)
ScriptInterpreter(Debugger &debugger, lldb::ScriptLanguage script_lang, lldb::ScriptedPlatformInterfaceUP scripted_platform_interface_up=std::make_unique< ScriptedPlatformInterface >())
std::shared_ptr< File > GetFileSP()
A stream class that can stream formatted output to a file.
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
virtual void Flush()=0
Flush the stream.
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
void SetConnection(std::unique_ptr< Connection > connection) override
Sets the connection that it to be used by this class.
lldb::ConnectionStatus Disconnect(Status *error_ptr=nullptr) override
Disconnect the communications connection if one is currently connected.
virtual bool StartReadThread(Status *error_ptr=nullptr)
Starts a read thread whose sole purpose it to read bytes from the current connection.
virtual bool JoinReadThread(Status *error_ptr=nullptr)
void SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback, void *callback_baton)
"lldb/Breakpoint/WatchpointOptions.h" Class that manages the options on a watchpoint.
A class that represents a running process on the host machine.
std::unique_ptr< lldb_private::ScriptedPlatformInterface > ScriptedPlatformInterfaceUP
ScriptLanguage
Script interpreter types.
std::shared_ptr< lldb_private::ProcessAttachInfo > ProcessAttachInfoSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::ProcessLaunchInfo > ProcessLaunchInfoSP