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;
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>
140 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
141 const char *callback_text) {
146 if (!
error.Success())
153 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
159 if (!
error.Success())
165std::unique_ptr<ScriptInterpreterLocker>
167 return std::make_unique<ScriptInterpreterLocker>();
172 if (src && src_len) {
174 strm->
Write(src, src_len);
179llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>>
183 return std::unique_ptr<ScriptInterpreterIORedirect>(
189 return nullin.takeError();
194 return nullin.takeError();
196 return std::unique_ptr<ScriptInterpreterIORedirect>(
201 std::unique_ptr<File> input, std::unique_ptr<File> output)
202 : m_input_file_sp(std::move(input)),
203 m_output_file_sp(std::make_shared<
StreamFile>(std::move(output))),
204 m_error_file_sp(m_output_file_sp),
205 m_communication(
"lldb.ScriptInterpreterIORedirect.comm"),
206 m_disconnect(false) {}
210 : m_communication(
"lldb.ScriptInterpreterIORedirect.comm"),
211 m_disconnect(false) {
221 std::unique_ptr<ConnectionGenericFile> conn_up =
222 std::make_unique<ConnectionGenericFile>(read_file,
true);
224 std::unique_ptr<ConnectionFileDescriptor> conn_up =
225 std::make_unique<ConnectionFileDescriptor>(
229 if (conn_up->IsConnected()) {
240 ::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
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
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)
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