9#ifndef LLDB_INTERPRETER_SCRIPTINTERPRETER_H
10#define LLDB_INTERPRETER_SCRIPTINTERPRETER_H
121 static llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>>
139 std::unique_ptr<File> output);
184 llvm::SmallVector<llvm::StringRef>
path;
187 virtual llvm::Expected<FileSpec>
189 std::vector<ExtensionTemplateRequest> &extensions,
190 bool generate_non_abstract_methods,
191 std::string output_file);
210 const char *in_string,
235 const void *name_token =
nullptr) {
241 const void *name_token =
nullptr) {
246 std::string &output) {
251 const void *name_token =
nullptr) {
256 const void *name_token =
nullptr) {
289 std::vector<std::reference_wrapper<BreakpointOptions>> &options,
298 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
299 const char *callback_text);
302 const char *callback_text,
310 std::unique_ptr<BreakpointOptions::CommandData> &data_up) {
315 std::vector<std::reference_wrapper<BreakpointOptions>> &bp_options_vec,
321 const char *function_name,
328 const char *user_input,
335 std::string &retval) {
362 virtual llvm::Expected<uint32_t>
364 const char *child_name) {
365 return llvm::createStringError(
"Type has no child named '%s'", child_name);
413 virtual std::optional<std::string>
422 size_t args_pos,
size_t char_in_arg) {
429 size_t char_in_arg) {
434 Process *process, std::string &output,
490 llvm::StringRef long_option, llvm::StringRef value) {
523 virtual llvm::Expected<unsigned>
525 return llvm::createStringError(
526 llvm::inconvertibleErrorCode(),
"Unimplemented function");
533 virtual llvm::Expected<std::string>
535 return llvm::make_error<UnimplementedError>();
538 static llvm::StringLiteral
604 std::string conflicting_keyword)
static llvm::raw_ostream & error(Stream &strm)
Represents a list of SBFrame objects.
A command line argument class.
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
A uniqued constant string class.
A class to manage flag bits.
bool GetSetLLDBGlobals() const
bool GetMaskoutErrors() const
ExecuteScriptOptions & SetMaskoutErrors(bool maskout)
ExecuteScriptOptions & SetSetLLDBGlobals(bool set)
ExecuteScriptOptions & SetEnableIO(bool enable)
ExecuteScriptOptions()=default
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool GetInitSession() const
LoadScriptOptions & SetInitSession(bool b)
LoadScriptOptions & SetSilent(bool b)
LoadScriptOptions()=default
std::recursive_mutex Mutex
PluginInterface()=default
A plug-in interface definition class for debugging a process.
lldb::FileSP GetOutputFile() const
lldb::FileSP m_input_file_sp
ThreadedCommunication m_communication
lldb::FileSP GetErrorFile() const
~ScriptInterpreterIORedirect()
void Flush()
Flush our output and error file handles.
ScriptInterpreterIORedirect(std::unique_ptr< File > input, std::unique_ptr< File > output)
lldb::FileSP GetInputFile() const
static llvm::Expected< std::unique_ptr< ScriptInterpreterIORedirect > > Create(bool enable_io, Debugger &debugger, CommandReturnObject *result)
Create an IO redirect.
lldb::LockableStreamFileSP m_error_file_sp
LockableStreamFile::Mutex m_output_mutex
lldb::LockableStreamFileSP m_output_file_sp
ScriptInterpreterLocker()=default
const ScriptInterpreterLocker & operator=(const ScriptInterpreterLocker &)=delete
ScriptInterpreterLocker(const ScriptInterpreterLocker &)=delete
virtual ~ScriptInterpreterLocker()=default
Holds an lldb_private::Module name and a "sanitized" version of it for the purposes of loading a scri...
bool RequiredSanitization() const
Returns true if the original name has been sanitized (i.e., required changes).
llvm::StringRef GetSanitizedName() const
SanitizedScriptingModuleName(std::string name, std::string sanitized_name, std::string conflicting_keyword)
llvm::StringRef GetConflictingKeyword() const
std::string m_sanitized_name
std::string m_original_name
llvm::StringRef GetOriginalName() const
std::string m_conflicting_keyword
If the m_sanitized_name conflicts with a keyword for the ScriptInterpreter language associated with t...
bool IsKeyword() const
Returns true if this name is a keyword in the associated scripting language.
virtual bool SetOptionValueForCommandObject(StructuredData::GenericSP cmd_obj_sp, ExecutionContext *exe_ctx, llvm::StringRef long_option, llvm::StringRef value)
static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string)
virtual lldb::ScriptedHookInterfaceSP CreateScriptedHookInterface()
virtual void CollectDataForBreakpointCommandCallback(std::vector< std::reference_wrapper< BreakpointOptions > > &options, CommandReturnObject &result)
const char * GetScriptInterpreterPtyName()
lldb::ProcessAttachInfoSP GetOpaqueTypeFromSBAttachInfo(const lldb::SBAttachInfo &attach_info) const
virtual Status ExecuteMultipleLines(const char *in_string, const ExecuteScriptOptions &options=ExecuteScriptOptions())
lldb::StreamSP GetOpaqueTypeFromSBStream(const lldb::SBStream &stream) const
virtual StructuredData::GenericSP CreateScriptCommandObject(const char *class_name)
virtual size_t CalculateNumChildren(const StructuredData::ObjectSP &implementor, uint32_t max)
virtual bool GenerateTypeScriptFunction(const char *oneliner, std::string &output, const void *name_token=nullptr)
virtual bool RunScriptFormatKeyword(const char *impl_function, Target *target, std::string &output, Status &error)
virtual bool GenerateTypeScriptFunction(StringList &input, std::string &output, const void *name_token=nullptr)
virtual lldb::ScriptedProcessInterfaceUP CreateScriptedProcessInterface()
virtual lldb::ScriptedFrameInterfaceSP CreateScriptedFrameInterface()
virtual Status ExportFunctionDefinitionToInterpreter(StringList &function_def)
lldb::ExecutionContextRefSP GetOpaqueTypeFromSBExecutionContext(const lldb::SBExecutionContext &exe_ctx) const
~ScriptInterpreter() override=default
virtual lldb::OperatingSystemInterfaceSP CreateOperatingSystemInterface()
virtual StructuredData::ObjectSP CreateSyntheticScriptedProvider(const char *class_name, lldb::ValueObjectSP valobj)
SymbolContext GetOpaqueTypeFromSBSymbolContext(const lldb::SBSymbolContext &sym_ctx) const
virtual Status SetBreakpointCommandCallbackFunction(BreakpointOptions &bp_options, const char *function_name, StructuredData::ObjectSP extra_args_sp)
Set a script function as the callback for the breakpoint.
virtual llvm::Expected< unsigned > GetMaxPositionalArgumentsForCallable(const llvm::StringRef &callable_name)
virtual bool ExecuteOneLineWithReturn(llvm::StringRef in_string, ScriptReturnType return_type, void *ret_value, const ExecuteScriptOptions &options=ExecuteScriptOptions())
virtual bool GenerateTypeSynthClass(StringList &input, std::string &output, const void *name_token=nullptr)
virtual bool RunScriptBasedCommand(const char *impl_function, llvm::StringRef args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx)
virtual llvm::Expected< FileSpec > GenerateExtensionTemplate(const std::string &name, std::vector< ExtensionTemplateRequest > &extensions, bool generate_non_abstract_methods, std::string output_file)
virtual void ExecuteInterpreterLoop()=0
virtual lldb::ScriptedBreakpointInterfaceSP CreateScriptedBreakpointInterface()
virtual bool GenerateScriptAliasFunction(StringList &input, std::string &output)
lldb::ThreadSP GetOpaqueTypeFromSBThread(const lldb::SBThread &exe_ctx) const
static llvm::StringLiteral ExtensionToString(lldb::ScriptedExtension extension)
virtual llvm::Expected< std::string > ExtensionToImportPath(lldb::ScriptedExtension extension)
virtual bool MightHaveChildrenSynthProviderInstance(const StructuredData::ObjectSP &implementor)
static lldb::ScriptedExtension StringToExtension(llvm::StringRef string)
std::optional< MemoryRegionInfo > GetOpaqueTypeFromSBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &mem_region) const
lldb::ValueObjectSP GetOpaqueTypeFromSBValue(const lldb::SBValue &value) const
virtual bool GenerateWatchpointCommandCallbackData(StringList &input, std::string &output, bool is_callback)
virtual StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, lldb_private::Status &error)
virtual StructuredData::DictionarySP HandleOptionArgumentCompletionForScriptedCommand(StructuredData::GenericSP impl_obj_sp, llvm::StringRef &long_name, size_t char_in_arg)
virtual Status GenerateFunction(const char *signature, const StringList &input, bool is_callback)
virtual lldb::ValueObjectSP GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx)
Event * GetOpaqueTypeFromSBEvent(const lldb::SBEvent &event) const
virtual std::optional< std::string > GetRepeatCommandForScriptedCommand(StructuredData::GenericSP impl_obj_sp, Args &args)
virtual void SetWatchpointCommandCallback(WatchpointOptions *wp_options, const char *user_input, bool is_callback)
Set a one-liner as the callback for the watchpoint.
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
virtual lldb::ValueObjectSP GetSyntheticValue(const StructuredData::ObjectSP &implementor)
virtual bool ExecuteOneLine(llvm::StringRef command, CommandReturnObject *result, const ExecuteScriptOptions &options=ExecuteScriptOptions())=0
virtual bool LoadScriptingModule(const char *filename, const LoadScriptOptions &options, lldb_private::Status &error, StructuredData::ObjectSP *module_sp=nullptr, FileSpec extra_search_dir={}, lldb::TargetSP loaded_into_target_sp={})
virtual llvm::Expected< uint32_t > GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, const char *child_name)
virtual bool RunScriptFormatKeyword(const char *impl_function, StackFrame *frame, std::string &output, Status &error)
virtual Status GenerateBreakpointCommandCallbackData(StringList &input, std::string &output, bool has_extra_args, bool is_callback)
static std::string LanguageToString(lldb::ScriptLanguage language)
virtual bool RunScriptFormatKeyword(const char *impl_function, ValueObject *value, std::string &output, Status &error)
Status GetStatusFromSBError(const lldb::SBError &error) const
virtual std::unique_ptr< ScriptInterpreterLocker > AcquireInterpreterLock()
virtual bool GetDocumentationForItem(const char *item, std::string &dest)
virtual StructuredData::DictionarySP GetInterpreterInfo()
lldb::BreakpointLocationSP GetOpaqueTypeFromSBBreakpointLocation(const lldb::SBBreakpointLocation &break_loc) const
virtual bool UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor)
lldb::TargetSP GetOpaqueTypeFromSBTarget(const lldb::SBTarget &target) const
virtual StructuredData::ObjectSP LoadPluginModule(const FileSpec &file_spec, lldb_private::Status &error)
virtual bool RunScriptBasedParsedCommand(StructuredData::GenericSP impl_obj_sp, Args &args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx)
Status SetBreakpointCommandCallbackFunction(std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, const char *function_name, StructuredData::ObjectSP extra_args_sp)
virtual bool GenerateTypeSynthClass(const char *oneliner, std::string &output, const void *name_token=nullptr)
virtual StructuredData::ObjectSP CreateStructuredDataFromScriptObject(ScriptObject obj)
virtual StructuredData::ObjectSP GetOptionsForCommandObject(StructuredData::GenericSP cmd_obj_sp)
virtual StructuredData::ObjectSP GetArgumentsForCommandObject(StructuredData::GenericSP cmd_obj_sp)
virtual void OptionParsingStartedForCommandObject(StructuredData::GenericSP cmd_obj_sp)
virtual bool GetScriptedSummary(const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp, const TypeSummaryOptions &options, std::string &retval)
virtual Status SetBreakpointCommandCallback(BreakpointOptions &bp_options, std::unique_ptr< BreakpointOptions::CommandData > &data_up)
This one is for deserialization:
lldb::BreakpointSP GetOpaqueTypeFromSBBreakpoint(const lldb::SBBreakpoint &breakpoint) const
virtual bool GetLongHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string &dest)
virtual lldb::ScriptedThreadPlanInterfaceSP CreateScriptedThreadPlanInterface()
virtual bool RunScriptFormatKeyword(const char *impl_function, Thread *thread, std::string &output, Status &error)
virtual bool CheckObjectExists(const char *name)
virtual bool RunScriptBasedCommand(StructuredData::GenericSP impl_obj_sp, llvm::StringRef args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx)
virtual bool FormatterCallbackFunction(const char *function_name, lldb::TypeImplSP type_impl_sp)
virtual ConstString GetSyntheticTypeName(const StructuredData::ObjectSP &implementor)
lldb::ScriptLanguage m_script_lang
lldb::ScriptLanguage GetLanguage()
virtual uint32_t GetFlagsForCommandObject(StructuredData::GenericSP cmd_obj_sp)
@ eScriptReturnTypeOpaqueObject
@ eScriptReturnTypeDouble
@ eScriptReturnTypeLongLongUnsigned
@ eScriptReturnTypeIntUnsigned
@ eScriptReturnTypeLongIntUnsigned
@ eScriptReturnTypeShortInt
@ eScriptReturnTypeCharPtr
@ eScriptReturnTypeLongInt
@ eScriptReturnTypeShortIntUnsigned
@ eScriptReturnTypeCharStrOrNone
@ eScriptReturnTypeLongLong
lldb::StackFrameListSP GetOpaqueTypeFromSBFrameList(const lldb::SBFrameList &exe_ctx) const
virtual bool GetShortHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp, std::string &dest)
lldb::StackFrameSP GetOpaqueTypeFromSBFrame(const lldb::SBFrame &frame) const
virtual bool IsReservedWord(const char *word)
virtual StructuredData::DictionarySP HandleArgumentCompletionForScriptedCommand(StructuredData::GenericSP impl_obj_sp, std::vector< llvm::StringRef > &args, size_t args_pos, size_t char_in_arg)
lldb::DataExtractorSP GetDataExtractorFromSBData(const lldb::SBData &data) const
virtual lldb::ScriptedPlatformInterfaceUP GetScriptedPlatformInterface()
virtual bool RunScriptFormatKeyword(const char *impl_function, Process *process, std::string &output, Status &error)
virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface()
virtual Status SetBreakpointCommandCallback(BreakpointOptions &bp_options, const char *callback_text, bool is_callback)
virtual lldb::ScriptedFrameProviderInterfaceSP CreateScriptedFrameProviderInterface()
ScriptInterpreter(Debugger &debugger, lldb::ScriptLanguage script_lang)
virtual void CollectDataForWatchpointCommandCallback(WatchpointOptions *wp_options, CommandReturnObject &result)
virtual SanitizedScriptingModuleName GetSanitizedScriptingModuleName(llvm::StringRef name)
virtual lldb::ScriptedStackFrameRecognizerInterfaceSP CreateScriptedStackFrameRecognizerInterface()
This base class provides an interface to stack frames.
static Status FromErrorString(const char *str)
std::shared_ptr< Generic > GenericSP
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
Defines a symbol context baton that can be handed other debug core functions.
"lldb/Core/ThreadedCommunication.h" Variation of Communication that supports threaded reads.
"lldb/Breakpoint/WatchpointOptions.h" Class that manages the options on a watchpoint.
A class that represents a running process on the host machine.
ScriptedCommandSynchronicity
std::unique_ptr< lldb_private::ScriptedPlatformInterface > ScriptedPlatformInterfaceUP
ScriptLanguage
Script interpreter types.
ScriptedExtension
Scripting extension types.
std::shared_ptr< lldb_private::ScriptedHookInterface > ScriptedHookInterfaceSP
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::ScriptedThreadPlanInterface > ScriptedThreadPlanInterfaceSP
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ProcessAttachInfo > ProcessAttachInfoSP
std::shared_ptr< lldb_private::OperatingSystemInterface > OperatingSystemInterfaceSP
std::shared_ptr< lldb_private::Stream > StreamSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::ScriptedBreakpointInterface > ScriptedBreakpointInterfaceSP
std::shared_ptr< lldb_private::ScriptedThreadInterface > ScriptedThreadInterfaceSP
std::shared_ptr< lldb_private::ScriptedFrameProviderInterface > ScriptedFrameProviderInterfaceSP
std::shared_ptr< lldb_private::LockableStreamFile > LockableStreamFileSP
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::File > FileSP
std::shared_ptr< lldb_private::ScriptedStackFrameRecognizerInterface > ScriptedStackFrameRecognizerInterfaceSP
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::unique_ptr< lldb_private::ScriptedProcessInterface > ScriptedProcessInterfaceUP
std::shared_ptr< lldb_private::ProcessLaunchInfo > ProcessLaunchInfoSP
std::shared_ptr< lldb_private::StackFrameList > StackFrameListSP
std::shared_ptr< lldb_private::ScriptedFrameInterface > ScriptedFrameInterfaceSP
std::shared_ptr< lldb_private::ExecutionContextRef > ExecutionContextRefSP
Describes one extension to emit into the generated template file.
llvm::StringRef full_name
llvm::SmallVector< llvm::StringRef > path