32 : m_debugger(debugger), m_script_lang(script_lang) {}
35 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
38 "This script interpreter does not support breakpoint callbacks.");
44 "This script interpreter does not support watchpoint callbacks.");
57 "This script interpreter does not support importing modules.");
72 llvm_unreachable(
"Unhandled ScriptInterpreter!");
92 return std::make_shared<ProcessLaunchInfo>(
98 if (
error.m_opaque_up)
99 return error.m_opaque_up->Clone();
106 return event.m_opaque_ptr;
112 lldb::StreamSP s = std::make_shared<lldb_private::StreamString>();
113 *s << reinterpret_cast<StreamString *>(stream.
m_opaque_up.get())->m_packet;
120std::optional<MemoryRegionInfo>
146 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
147 const char *callback_text) {
152 if (!
error.Success())
159 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
165 if (!
error.Success())
171std::unique_ptr<ScriptInterpreterLocker>
173 return std::make_unique<ScriptInterpreterLocker>();
178 if (src && src_len) {
180 strm->
Write(src, src_len);
185llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>>
189 return std::unique_ptr<ScriptInterpreterIORedirect>(
195 return nullin.takeError();
200 return nullin.takeError();
202 return std::unique_ptr<ScriptInterpreterIORedirect>(
207 std::unique_ptr<File> input, std::unique_ptr<File> output)
208 : m_input_file_sp(std::move(input)),
209 m_output_file_sp(std::make_shared<
StreamFile>(std::move(output))),
210 m_error_file_sp(m_output_file_sp),
211 m_communication(
"lldb.ScriptInterpreterIORedirect.comm"),
212 m_disconnect(false) {}
216 : m_communication(
"lldb.ScriptInterpreterIORedirect.comm"),
217 m_disconnect(false) {
227 std::unique_ptr<ConnectionGenericFile> conn_up =
228 std::make_unique<ConnectionGenericFile>(read_file,
true);
230 std::unique_ptr<ConnectionFileDescriptor> conn_up =
231 std::make_unique<ConnectionFileDescriptor>(
235 if (conn_up->IsConnected()) {
246 ::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
lldb::ExecutionContextRefSP m_exe_ctx_sp
std::shared_ptr< lldb_private::SBLaunchInfoImpl > m_opaque_sp
lldb::MemoryRegionInfoUP m_opaque_up
std::unique_ptr< lldb_private::Stream > 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={})
lldb::StreamSP GetOpaqueTypeFromSBStream(const lldb::SBStream &stream) const
lldb::ExecutionContextRefSP GetOpaqueTypeFromSBExecutionContext(const lldb::SBExecutionContext &exe_ctx) const
Event * GetOpaqueTypeFromSBEvent(const lldb::SBEvent &event) const
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
ScriptInterpreter(Debugger &debugger, lldb::ScriptLanguage script_lang)
virtual void CollectDataForWatchpointCommandCallback(WatchpointOptions *wp_options, CommandReturnObject &result)
static Status FromErrorString(const char *str)
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.
ScriptLanguage
Script interpreter types.
std::shared_ptr< lldb_private::ProcessAttachInfo > ProcessAttachInfoSP
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::ProcessLaunchInfo > ProcessLaunchInfoSP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP