LLDB mainline
lldb_private::ScriptInterpreterLua Class Reference

#include <ScriptInterpreterLua.h>

Inheritance diagram for lldb_private::ScriptInterpreterLua:
[legend]

Classes

class  CommandDataLua

Public Member Functions

 ScriptInterpreterLua (Debugger &debugger)
 ~ScriptInterpreterLua () override
bool ExecuteOneLine (llvm::StringRef command, CommandReturnObject *result, const ExecuteScriptOptions &options=ExecuteScriptOptions()) override
void ExecuteInterpreterLoop () override
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={}) override
StructuredData::DictionarySP GetInterpreterInfo () override
llvm::StringRef GetPluginName () override
LuaGetLua ()
llvm::Error EnterSession (lldb::user_id_t debugger_id)
llvm::Error LeaveSession ()
void CollectDataForBreakpointCommandCallback (std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, CommandReturnObject &result) override
void CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options, CommandReturnObject &result) override
Status SetBreakpointCommandCallback (BreakpointOptions &bp_options, const char *command_body_text, bool is_callback) override
void SetWatchpointCommandCallback (WatchpointOptions *wp_options, const char *command_body_text, bool is_callback) override
 Set a one-liner as the callback for the watchpoint.
Status SetBreakpointCommandCallbackFunction (BreakpointOptions &bp_options, const char *function_name, StructuredData::ObjectSP extra_args_sp) override
 Set a script function as the callback for the breakpoint.
Public Member Functions inherited from lldb_private::ScriptInterpreter
 ScriptInterpreter (Debugger &debugger, lldb::ScriptLanguage script_lang)
 ~ScriptInterpreter () override=default
virtual bool Interrupt ()
virtual bool ExecuteOneLineWithReturn (llvm::StringRef in_string, ScriptReturnType return_type, void *ret_value, const ExecuteScriptOptions &options=ExecuteScriptOptions())
virtual Status ExecuteMultipleLines (const char *in_string, const ExecuteScriptOptions &options=ExecuteScriptOptions())
virtual Status ExportFunctionDefinitionToInterpreter (StringList &function_def)
virtual Status GenerateBreakpointCommandCallbackData (StringList &input, std::string &output, bool has_extra_args, bool is_callback)
virtual bool GenerateWatchpointCommandCallbackData (StringList &input, std::string &output, bool is_callback)
virtual bool GenerateTypeScriptFunction (const char *oneliner, std::string &output, const void *name_token=nullptr)
virtual bool GenerateTypeScriptFunction (StringList &input, std::string &output, const void *name_token=nullptr)
virtual bool GenerateScriptAliasFunction (StringList &input, std::string &output)
virtual bool GenerateTypeSynthClass (StringList &input, std::string &output, const void *name_token=nullptr)
virtual bool GenerateTypeSynthClass (const char *oneliner, std::string &output, const void *name_token=nullptr)
virtual StructuredData::ObjectSP CreateSyntheticScriptedProvider (const char *class_name, lldb::ValueObjectSP valobj)
virtual StructuredData::GenericSP CreateScriptCommandObject (const char *class_name)
virtual StructuredData::GenericSP CreateFrameRecognizer (const char *class_name)
virtual lldb::ValueObjectListSP GetRecognizedArguments (const StructuredData::ObjectSP &implementor, lldb::StackFrameSP frame_sp)
virtual bool ShouldHide (const StructuredData::ObjectSP &implementor, lldb::StackFrameSP frame_sp)
virtual StructuredData::ObjectSP LoadPluginModule (const FileSpec &file_spec, lldb_private::Status &error)
virtual StructuredData::DictionarySP GetDynamicSettings (StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, lldb_private::Status &error)
virtual Status GenerateFunction (const char *signature, const StringList &input, bool is_callback)
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.
virtual Status SetBreakpointCommandCallback (BreakpointOptions &bp_options, std::unique_ptr< BreakpointOptions::CommandData > &data_up)
 This one is for deserialization:
Status SetBreakpointCommandCallbackFunction (std::vector< std::reference_wrapper< BreakpointOptions > > &bp_options_vec, const char *function_name, StructuredData::ObjectSP extra_args_sp)
virtual bool GetScriptedSummary (const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp, const TypeSummaryOptions &options, std::string &retval)
virtual bool FormatterCallbackFunction (const char *function_name, lldb::TypeImplSP type_impl_sp)
virtual void Clear ()
virtual size_t CalculateNumChildren (const StructuredData::ObjectSP &implementor, uint32_t max)
virtual lldb::ValueObjectSP GetChildAtIndex (const StructuredData::ObjectSP &implementor, uint32_t idx)
virtual llvm::Expected< int > GetIndexOfChildWithName (const StructuredData::ObjectSP &implementor, const char *child_name)
virtual bool UpdateSynthProviderInstance (const StructuredData::ObjectSP &implementor)
virtual bool MightHaveChildrenSynthProviderInstance (const StructuredData::ObjectSP &implementor)
virtual lldb::ValueObjectSP GetSyntheticValue (const StructuredData::ObjectSP &implementor)
virtual ConstString GetSyntheticTypeName (const StructuredData::ObjectSP &implementor)
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 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 RunScriptBasedParsedCommand (StructuredData::GenericSP impl_obj_sp, Args &args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, Status &error, const lldb_private::ExecutionContext &exe_ctx)
virtual std::optional< std::string > GetRepeatCommandForScriptedCommand (StructuredData::GenericSP impl_obj_sp, Args &args)
virtual StructuredData::DictionarySP HandleArgumentCompletionForScriptedCommand (StructuredData::GenericSP impl_obj_sp, std::vector< llvm::StringRef > &args, size_t args_pos, size_t char_in_arg)
virtual StructuredData::DictionarySP HandleOptionArgumentCompletionForScriptedCommand (StructuredData::GenericSP impl_obj_sp, llvm::StringRef &long_name, size_t char_in_arg)
virtual bool RunScriptFormatKeyword (const char *impl_function, Process *process, std::string &output, Status &error)
virtual bool RunScriptFormatKeyword (const char *impl_function, Thread *thread, std::string &output, Status &error)
virtual bool RunScriptFormatKeyword (const char *impl_function, Target *target, std::string &output, Status &error)
virtual bool RunScriptFormatKeyword (const char *impl_function, StackFrame *frame, std::string &output, Status &error)
virtual bool RunScriptFormatKeyword (const char *impl_function, ValueObject *value, std::string &output, Status &error)
virtual bool GetDocumentationForItem (const char *item, std::string &dest)
virtual bool GetShortHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp, std::string &dest)
virtual StructuredData::ObjectSP GetOptionsForCommandObject (StructuredData::GenericSP cmd_obj_sp)
virtual StructuredData::ObjectSP GetArgumentsForCommandObject (StructuredData::GenericSP cmd_obj_sp)
virtual bool SetOptionValueForCommandObject (StructuredData::GenericSP cmd_obj_sp, ExecutionContext *exe_ctx, llvm::StringRef long_option, llvm::StringRef value)
virtual void OptionParsingStartedForCommandObject (StructuredData::GenericSP cmd_obj_sp)
virtual uint32_t GetFlagsForCommandObject (StructuredData::GenericSP cmd_obj_sp)
virtual bool GetLongHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp, std::string &dest)
virtual bool CheckObjectExists (const char *name)
virtual bool IsReservedWord (const char *word)
virtual std::unique_ptr< ScriptInterpreterLockerAcquireInterpreterLock ()
const char * GetScriptInterpreterPtyName ()
virtual llvm::Expected< unsigned > GetMaxPositionalArgumentsForCallable (const llvm::StringRef &callable_name)
lldb::ScriptLanguage GetLanguage ()
virtual lldb::ScriptedProcessInterfaceUP CreateScriptedProcessInterface ()
virtual lldb::ScriptedThreadInterfaceSP CreateScriptedThreadInterface ()
virtual lldb::ScriptedFrameInterfaceSP CreateScriptedFrameInterface ()
virtual lldb::ScriptedThreadPlanInterfaceSP CreateScriptedThreadPlanInterface ()
virtual lldb::OperatingSystemInterfaceSP CreateOperatingSystemInterface ()
virtual lldb::ScriptedPlatformInterfaceUP GetScriptedPlatformInterface ()
virtual lldb::ScriptedStopHookInterfaceSP CreateScriptedStopHookInterface ()
virtual lldb::ScriptedBreakpointInterfaceSP CreateScriptedBreakpointInterface ()
virtual StructuredData::ObjectSP CreateStructuredDataFromScriptObject (ScriptObject obj)
lldb::DataExtractorSP GetDataExtractorFromSBData (const lldb::SBData &data) const
Status GetStatusFromSBError (const lldb::SBError &error) const
EventGetOpaqueTypeFromSBEvent (const lldb::SBEvent &event) const
lldb::StreamSP GetOpaqueTypeFromSBStream (const lldb::SBStream &stream) const
SymbolContext GetOpaqueTypeFromSBSymbolContext (const lldb::SBSymbolContext &sym_ctx) const
lldb::BreakpointSP GetOpaqueTypeFromSBBreakpoint (const lldb::SBBreakpoint &breakpoint) const
lldb::ProcessAttachInfoSP GetOpaqueTypeFromSBAttachInfo (const lldb::SBAttachInfo &attach_info) const
lldb::ProcessLaunchInfoSP GetOpaqueTypeFromSBLaunchInfo (const lldb::SBLaunchInfo &launch_info) const
std::optional< MemoryRegionInfoGetOpaqueTypeFromSBMemoryRegionInfo (const lldb::SBMemoryRegionInfo &mem_region) const
lldb::ExecutionContextRefSP GetOpaqueTypeFromSBExecutionContext (const lldb::SBExecutionContext &exe_ctx) const
Public Member Functions inherited from lldb_private::PluginInterface
 PluginInterface ()=default
virtual ~PluginInterface ()=default
 PluginInterface (const PluginInterface &)=delete
PluginInterfaceoperator= (const PluginInterface &)=delete

Static Public Member Functions

static void Initialize ()
static void Terminate ()
static lldb::ScriptInterpreterSP CreateInstance (Debugger &debugger)
static llvm::StringRef GetPluginNameStatic ()
static llvm::StringRef GetPluginDescriptionStatic ()
static bool BreakpointCallbackFunction (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
static bool WatchpointCallbackFunction (void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id)
Static Public Member Functions inherited from lldb_private::ScriptInterpreter
static std::string LanguageToString (lldb::ScriptLanguage language)
static lldb::ScriptLanguage StringToLanguage (const llvm::StringRef &string)

Private Member Functions

Status RegisterBreakpointCallback (BreakpointOptions &bp_options, const char *command_body_text, StructuredData::ObjectSP extra_args_sp)
Status RegisterWatchpointCallback (WatchpointOptions *wp_options, const char *command_body_text, StructuredData::ObjectSP extra_args_sp)

Private Attributes

std::unique_ptr< Luam_lua
bool m_session_is_active = false

Additional Inherited Members

Public Types inherited from lldb_private::ScriptInterpreter
enum  ScriptReturnType {
  eScriptReturnTypeCharPtr , eScriptReturnTypeBool , eScriptReturnTypeShortInt , eScriptReturnTypeShortIntUnsigned ,
  eScriptReturnTypeInt , eScriptReturnTypeIntUnsigned , eScriptReturnTypeLongInt , eScriptReturnTypeLongIntUnsigned ,
  eScriptReturnTypeLongLong , eScriptReturnTypeLongLongUnsigned , eScriptReturnTypeFloat , eScriptReturnTypeDouble ,
  eScriptReturnTypeChar , eScriptReturnTypeCharStrOrNone , eScriptReturnTypeOpaqueObject
}
Protected Attributes inherited from lldb_private::ScriptInterpreter
Debuggerm_debugger
lldb::ScriptLanguage m_script_lang

Detailed Description

Definition at line 22 of file ScriptInterpreterLua.h.

Constructor & Destructor Documentation

◆ ScriptInterpreterLua()

ScriptInterpreterLua::ScriptInterpreterLua ( Debugger & debugger)

◆ ~ScriptInterpreterLua()

ScriptInterpreterLua::~ScriptInterpreterLua ( )
overridedefault

References error().

Member Function Documentation

◆ BreakpointCallbackFunction()

◆ CollectDataForBreakpointCommandCallback()

void ScriptInterpreterLua::CollectDataForBreakpointCommandCallback ( std::vector< std::reference_wrapper< BreakpointOptions > > & bp_options_vec,
CommandReturnObject & result )
overridevirtual

◆ CollectDataForWatchpointCommandCallback()

void ScriptInterpreterLua::CollectDataForWatchpointCommandCallback ( WatchpointOptions * wp_options,
CommandReturnObject & result )
overridevirtual

◆ CreateInstance()

lldb::ScriptInterpreterSP ScriptInterpreterLua::CreateInstance ( Debugger & debugger)
static

Definition at line 407 of file ScriptInterpreterLua.cpp.

Referenced by Initialize().

◆ EnterSession()

llvm::Error ScriptInterpreterLua::EnterSession ( lldb::user_id_t debugger_id)

Definition at line 254 of file ScriptInterpreterLua.cpp.

References m_lua, and m_session_is_active.

◆ ExecuteInterpreterLoop()

void ScriptInterpreterLua::ExecuteInterpreterLoop ( )
overridevirtual

◆ ExecuteOneLine()

◆ GetInterpreterInfo()

StructuredData::DictionarySP ScriptInterpreterLua::GetInterpreterInfo ( )
overridevirtual

Reimplemented from lldb_private::ScriptInterpreter.

Definition at line 164 of file ScriptInterpreterLua.cpp.

◆ GetLua()

Lua & ScriptInterpreterLua::GetLua ( )

Definition at line 415 of file ScriptInterpreterLua.cpp.

References m_lua.

Referenced by BreakpointCallbackFunction(), and WatchpointCallbackFunction().

◆ GetPluginDescriptionStatic()

llvm::StringRef ScriptInterpreterLua::GetPluginDescriptionStatic ( )
static

Definition at line 411 of file ScriptInterpreterLua.cpp.

Referenced by Initialize().

◆ GetPluginName()

llvm::StringRef lldb_private::ScriptInterpreterLua::GetPluginName ( )
inlineoverridevirtual

Implements lldb_private::PluginInterface.

Definition at line 76 of file ScriptInterpreterLua.h.

References GetPluginNameStatic().

◆ GetPluginNameStatic()

llvm::StringRef lldb_private::ScriptInterpreterLua::GetPluginNameStatic ( )
inlinestatic

Definition at line 62 of file ScriptInterpreterLua.h.

Referenced by GetPluginName(), and Initialize().

◆ Initialize()

◆ LeaveSession()

llvm::Error ScriptInterpreterLua::LeaveSession ( )

Definition at line 267 of file ScriptInterpreterLua.cpp.

References m_lua, and m_session_is_active.

◆ LoadScriptingModule()

bool ScriptInterpreterLua::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 = {} )
overridevirtual

◆ RegisterBreakpointCallback()

Status ScriptInterpreterLua::RegisterBreakpointCallback ( BreakpointOptions & bp_options,
const char * command_body_text,
StructuredData::ObjectSP extra_args_sp )
private

◆ RegisterWatchpointCallback()

Status ScriptInterpreterLua::RegisterWatchpointCallback ( WatchpointOptions * wp_options,
const char * command_body_text,
StructuredData::ObjectSP extra_args_sp )
private

◆ SetBreakpointCommandCallback()

Status ScriptInterpreterLua::SetBreakpointCommandCallback ( BreakpointOptions & bp_options,
const char * command_body_text,
bool is_callback )
overridevirtual

Reimplemented from lldb_private::ScriptInterpreter.

Definition at line 364 of file ScriptInterpreterLua.cpp.

References RegisterBreakpointCallback().

◆ SetBreakpointCommandCallbackFunction()

Status ScriptInterpreterLua::SetBreakpointCommandCallbackFunction ( BreakpointOptions & bp_options,
const char * function_name,
StructuredData::ObjectSP extra_args_sp )
overridevirtual

Set a script function as the callback for the breakpoint.

Reimplemented from lldb_private::ScriptInterpreter.

Definition at line 355 of file ScriptInterpreterLua.cpp.

References RegisterBreakpointCallback().

◆ SetWatchpointCommandCallback()

void ScriptInterpreterLua::SetWatchpointCommandCallback ( WatchpointOptions * wp_options,
const char * user_input,
bool is_callback )
overridevirtual

Set a one-liner as the callback for the watchpoint.

Reimplemented from lldb_private::ScriptInterpreter.

Definition at line 385 of file ScriptInterpreterLua.cpp.

References RegisterWatchpointCallback().

◆ Terminate()

void ScriptInterpreterLua::Terminate ( )
static

Definition at line 252 of file ScriptInterpreterLua.cpp.

◆ WatchpointCallbackFunction()

Member Data Documentation

◆ m_lua

std::unique_ptr<Lua> lldb_private::ScriptInterpreterLua::m_lua
private

◆ m_session_is_active

bool lldb_private::ScriptInterpreterLua::m_session_is_active = false
private

Definition at line 105 of file ScriptInterpreterLua.h.

Referenced by EnterSession(), and LeaveSession().


The documentation for this class was generated from the following files: