aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Interpreter/ScriptInterpreter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Interpreter/ScriptInterpreter.h')
-rw-r--r--include/lldb/Interpreter/ScriptInterpreter.h323
1 files changed, 97 insertions, 226 deletions
diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h
index 1b4b88161927..0f45dd8245e9 100644
--- a/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/include/lldb/Interpreter/ScriptInterpreter.h
@@ -14,53 +14,12 @@
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Error.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Utility/PseudoTerminal.h"
namespace lldb_private {
-
-class ScriptInterpreterObject
-{
-public:
- ScriptInterpreterObject() :
- m_object(NULL)
- {}
-
- ScriptInterpreterObject(void* obj) :
- m_object(obj)
- {}
-
- ScriptInterpreterObject(const ScriptInterpreterObject& rhs)
- : m_object(rhs.m_object)
- {}
-
- virtual void*
- GetObject()
- {
- return m_object;
- }
-
- explicit operator bool ()
- {
- return m_object != NULL;
- }
-
- ScriptInterpreterObject&
- operator = (const ScriptInterpreterObject& rhs)
- {
- if (this != &rhs)
- m_object = rhs.m_object;
- return *this;
- }
-
- virtual
- ~ScriptInterpreterObject()
- {}
-
-protected:
- void* m_object;
-};
class ScriptInterpreterLocker
{
@@ -82,87 +41,6 @@ class ScriptInterpreter
{
public:
- typedef void (*SWIGInitCallback) (void);
-
- typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name,
- const char *session_dictionary_name,
- const lldb::StackFrameSP& frame_sp,
- const lldb::BreakpointLocationSP &bp_loc_sp);
-
- typedef bool (*SWIGWatchpointCallbackFunction) (const char *python_function_name,
- const char *session_dictionary_name,
- const lldb::StackFrameSP& frame_sp,
- const lldb::WatchpointSP &wp_sp);
-
- typedef bool (*SWIGPythonTypeScriptCallbackFunction) (const char *python_function_name,
- void *session_dictionary,
- const lldb::ValueObjectSP& valobj_sp,
- void** pyfunct_wrapper,
- const lldb::TypeSummaryOptionsSP& options,
- std::string& retval);
-
- typedef void* (*SWIGPythonCreateSyntheticProvider) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ValueObjectSP& valobj_sp);
-
- typedef void* (*SWIGPythonCreateScriptedThreadPlan) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ThreadPlanSP& thread_plan_sp);
-
- typedef bool (*SWIGPythonCallThreadPlan) (void *implementor, const char *method_name, Event *event_sp, bool &got_error);
-
- typedef void* (*SWIGPythonCreateOSPlugin) (const char *python_class_name,
- const char *session_dictionary_name,
- const lldb::ProcessSP& process_sp);
-
- typedef uint32_t (*SWIGPythonCalculateNumChildren) (void *implementor);
- typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx);
- typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name);
- typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data);
- typedef lldb::ValueObjectSP (*SWIGPythonGetValueObjectSPFromSBValue) (void* data);
- typedef bool (*SWIGPythonUpdateSynthProviderInstance) (void* data);
- typedef bool (*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data);
- typedef void* (*SWIGPythonGetValueSynthProviderInstance) (void *implementor);
-
- typedef bool (*SWIGPythonCallCommand) (const char *python_function_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger,
- const char* args,
- lldb_private::CommandReturnObject& cmd_retobj,
- lldb::ExecutionContextRefSP exe_ctx_ref_sp);
-
- typedef bool (*SWIGPythonCallModuleInit) (const char *python_module_name,
- const char *session_dictionary_name,
- lldb::DebuggerSP& debugger);
-
- typedef bool (*SWIGPythonScriptKeyword_Process) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ProcessSP& process,
- std::string& output);
- typedef bool (*SWIGPythonScriptKeyword_Thread) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ThreadSP& thread,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Target) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::TargetSP& target,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Frame) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::StackFrameSP& frame,
- std::string& output);
-
- typedef bool (*SWIGPythonScriptKeyword_Value) (const char* python_function_name,
- const char* session_dictionary_name,
- lldb::ValueObjectSP& value,
- std::string& output);
-
- typedef void* (*SWIGPython_GetDynamicSetting) (void* module,
- const char* setting,
- const lldb::TargetSP& target_sp);
-
typedef enum
{
eScriptReturnTypeCharPtr,
@@ -324,95 +202,87 @@ public:
{
return false;
}
-
- virtual lldb::ScriptInterpreterObjectSP
- CreateSyntheticScriptedProvider (const char *class_name,
- lldb::ValueObjectSP valobj)
+
+ virtual StructuredData::ObjectSP
+ CreateSyntheticScriptedProvider(const char *class_name, lldb::ValueObjectSP valobj)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::ObjectSP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
+
+ virtual StructuredData::GenericSP
+ CreateScriptCommandObject (const char *class_name)
+ {
+ return StructuredData::GenericSP();
+ }
+
+ virtual StructuredData::GenericSP
OSPlugin_CreatePluginObject (const char *class_name,
lldb::ProcessSP process_sp)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::GenericSP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp)
+
+ virtual StructuredData::DictionarySP
+ OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::DictionarySP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp)
+
+ virtual StructuredData::ArraySP
+ OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::ArraySP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- OSPlugin_RegisterContextData (lldb::ScriptInterpreterObjectSP os_plugin_object_sp,
- lldb::tid_t thread_id)
+
+ virtual StructuredData::StringSP
+ OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t thread_id)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::StringSP();
}
- virtual lldb::ScriptInterpreterObjectSP
- OSPlugin_CreateThread (lldb::ScriptInterpreterObjectSP os_plugin_object_sp,
- lldb::tid_t tid,
- lldb::addr_t context)
+ virtual StructuredData::DictionarySP
+ OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t tid, lldb::addr_t context)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::DictionarySP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- CreateScriptedThreadPlan (const char *class_name,
- lldb::ThreadPlanSP thread_plan_sp)
+
+ virtual StructuredData::ObjectSP
+ CreateScriptedThreadPlan(const char *class_name, lldb::ThreadPlanSP thread_plan_sp)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::ObjectSP();
}
virtual bool
- ScriptedThreadPlanExplainsStop (lldb::ScriptInterpreterObjectSP implementor_sp,
- Event *event,
- bool &script_error)
+ ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error)
{
script_error = true;
return true;
}
virtual bool
- ScriptedThreadPlanShouldStop (lldb::ScriptInterpreterObjectSP implementor_sp,
- Event *event,
- bool &script_error)
+ ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error)
{
script_error = true;
return true;
}
virtual lldb::StateType
- ScriptedThreadPlanGetRunState (lldb::ScriptInterpreterObjectSP implementor_sp,
- bool &script_error)
+ ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error)
{
script_error = true;
return lldb::eStateStepping;
}
- virtual lldb::ScriptInterpreterObjectSP
- LoadPluginModule (const FileSpec& file_spec,
- lldb_private::Error& error)
+ virtual StructuredData::ObjectSP
+ LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::ObjectSP();
}
-
- virtual lldb::ScriptInterpreterObjectSP
- GetDynamicSettings (lldb::ScriptInterpreterObjectSP plugin_module_sp,
- Target* target,
- const char* setting_name,
- lldb_private::Error& error)
+
+ virtual StructuredData::DictionarySP
+ GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, lldb_private::Error &error)
{
- return lldb::ScriptInterpreterObjectSP();
+ return StructuredData::DictionarySP();
}
virtual Error
@@ -464,13 +334,10 @@ public:
{
return;
}
-
+
virtual bool
- GetScriptedSummary (const char *function_name,
- lldb::ValueObjectSP valobj,
- lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
- const TypeSummaryOptions& options,
- std::string& retval)
+ GetScriptedSummary(const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp,
+ const TypeSummaryOptions &options, std::string &retval)
{
return false;
}
@@ -480,39 +347,39 @@ public:
{
// Clean up any ref counts to SBObjects that might be in global variables
}
-
+
virtual size_t
- CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor)
+ CalculateNumChildren(const StructuredData::ObjectSP &implementor)
{
return 0;
}
-
+
virtual lldb::ValueObjectSP
- GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx)
+ GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx)
{
return lldb::ValueObjectSP();
}
-
+
virtual int
- GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name)
+ GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, const char *child_name)
{
return UINT32_MAX;
}
-
+
virtual bool
- UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor)
+ UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor)
{
return false;
}
-
+
virtual bool
- MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor)
+ MightHaveChildrenSynthProviderInstance(const StructuredData::ObjectSP &implementor)
{
return true;
}
-
+
virtual lldb::ValueObjectSP
- GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor)
+ GetSyntheticValue(const StructuredData::ObjectSP &implementor)
{
return nullptr;
}
@@ -529,6 +396,17 @@ public:
}
virtual bool
+ RunScriptBasedCommand (StructuredData::GenericSP impl_obj_sp,
+ const char* args,
+ ScriptedCommandSynchronicity synchronicity,
+ lldb_private::CommandReturnObject& cmd_retobj,
+ Error& error,
+ const lldb_private::ExecutionContext& exe_ctx)
+ {
+ return false;
+ }
+
+ virtual bool
RunScriptFormatKeyword (const char* impl_function,
Process* process,
std::string& output,
@@ -586,26 +464,45 @@ public:
}
virtual bool
+ GetShortHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp,
+ std::string& dest)
+ {
+ dest.clear();
+ return false;
+ }
+
+ virtual uint32_t
+ GetFlagsForCommandObject (StructuredData::GenericSP cmd_obj_sp)
+ {
+ return 0;
+ }
+
+ virtual bool
+ GetLongHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp,
+ std::string& dest)
+ {
+ dest.clear();
+ return false;
+ }
+
+ virtual bool
CheckObjectExists (const char* name)
{
return false;
}
virtual bool
- LoadScriptingModule (const char* filename,
- bool can_reload,
- bool init_session,
- lldb_private::Error& error,
- lldb::ScriptInterpreterObjectSP* module_sp = nullptr)
+ LoadScriptingModule(const char *filename, bool can_reload, bool init_session, lldb_private::Error &error,
+ StructuredData::ObjectSP *module_sp = nullptr)
{
error.SetErrorString("loading unimplemented");
return false;
}
-
- virtual lldb::ScriptInterpreterObjectSP
- MakeScriptObject (void* object)
+
+ virtual bool
+ IsReservedWord (const char* word)
{
- return lldb::ScriptInterpreterObjectSP(new ScriptInterpreterObject(object));
+ return false;
}
virtual std::unique_ptr<ScriptInterpreterLocker>
@@ -622,32 +519,6 @@ public:
static std::string
LanguageToString (lldb::ScriptLanguage language);
-
- static void
- InitializeInterpreter (SWIGInitCallback python_swig_init_callback,
- SWIGBreakpointCallbackFunction swig_breakpoint_callback,
- SWIGWatchpointCallbackFunction swig_watchpoint_callback,
- SWIGPythonTypeScriptCallbackFunction swig_typescript_callback,
- SWIGPythonCreateSyntheticProvider swig_synthetic_script,
- SWIGPythonCalculateNumChildren swig_calc_children,
- SWIGPythonGetChildAtIndex swig_get_child_index,
- SWIGPythonGetIndexOfChildWithName swig_get_index_child,
- SWIGPythonCastPyObjectToSBValue swig_cast_to_sbvalue ,
- SWIGPythonGetValueObjectSPFromSBValue swig_get_valobj_sp_from_sbvalue,
- SWIGPythonUpdateSynthProviderInstance swig_update_provider,
- SWIGPythonMightHaveChildrenSynthProviderInstance swig_mighthavechildren_provider,
- SWIGPythonGetValueSynthProviderInstance swig_getvalue_provider,
- SWIGPythonCallCommand swig_call_command,
- SWIGPythonCallModuleInit swig_call_module_init,
- SWIGPythonCreateOSPlugin swig_create_os_plugin,
- SWIGPythonScriptKeyword_Process swig_run_script_keyword_process,
- SWIGPythonScriptKeyword_Thread swig_run_script_keyword_thread,
- SWIGPythonScriptKeyword_Target swig_run_script_keyword_target,
- SWIGPythonScriptKeyword_Frame swig_run_script_keyword_frame,
- SWIGPythonScriptKeyword_Value swig_run_script_keyword_value,
- SWIGPython_GetDynamicSetting swig_plugin_get,
- SWIGPythonCreateScriptedThreadPlan swig_thread_plan_script,
- SWIGPythonCallThreadPlan swig_call_thread_plan);
virtual void
ResetOutputFileHandle (FILE *new_fh) { } //By default, do nothing.