diff options
Diffstat (limited to 'include/lldb/Interpreter')
-rw-r--r-- | include/lldb/Interpreter/Args.h | 12 | ||||
-rw-r--r-- | include/lldb/Interpreter/CommandInterpreter.h | 9 | ||||
-rw-r--r-- | include/lldb/Interpreter/OptionGroupPlatform.h | 6 | ||||
-rw-r--r-- | include/lldb/Interpreter/OptionValue.h | 15 | ||||
-rw-r--r-- | include/lldb/Interpreter/OptionValueFormatEntity.h | 107 | ||||
-rw-r--r-- | include/lldb/Interpreter/OptionValueProperties.h | 4 | ||||
-rw-r--r-- | include/lldb/Interpreter/OptionValueRegex.h | 8 | ||||
-rw-r--r-- | include/lldb/Interpreter/OptionValues.h | 1 | ||||
-rw-r--r-- | include/lldb/Interpreter/ScriptInterpreter.h | 16 | ||||
-rw-r--r-- | include/lldb/Interpreter/ScriptInterpreterPython.h | 194 |
10 files changed, 262 insertions, 110 deletions
diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h index 1071bd6fd0471..fe29df468de7d 100644 --- a/include/lldb/Interpreter/Args.h +++ b/include/lldb/Interpreter/Args.h @@ -347,18 +347,6 @@ public: bool trailing = true, bool return_null_if_empty = true); - static int32_t - StringToSInt32 (const char *s, int32_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static uint32_t - StringToUInt32 (const char *s, uint32_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static int64_t - StringToSInt64 (const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static uint64_t - StringToUInt64 (const char *s, uint64_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - static bool UInt64ValueIsValidForByteSize (uint64_t uval64, size_t total_byte_size) { diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h index baaa271a42856..20b6ff95be8bf 100644 --- a/include/lldb/Interpreter/CommandInterpreter.h +++ b/include/lldb/Interpreter/CommandInterpreter.h @@ -224,6 +224,7 @@ public: eCommandTypesBuiltin = 0x0001, // native commands such as "frame" eCommandTypesUserDef = 0x0002, // scripted commands eCommandTypesAliases = 0x0004, // aliases such as "po" + eCommandTypesHidden = 0x0008, // commands prefixed with an underscore eCommandTypesAllThem = 0xFFFF // all commands }; @@ -431,6 +432,11 @@ public: StreamString &help_string); void + OutputFormattedHelpText (Stream &strm, + const char *prefix, + const char *help_text); + + void OutputFormattedHelpText (Stream &stream, const char *command_word, const char *separator, @@ -607,6 +613,9 @@ public: bool asynchronously, void *baton); + const char * + GetCommandPrefix (); + //------------------------------------------------------------------ // Properties //------------------------------------------------------------------ diff --git a/include/lldb/Interpreter/OptionGroupPlatform.h b/include/lldb/Interpreter/OptionGroupPlatform.h index 970ad328ccb75..f7de50c86a563 100644 --- a/include/lldb/Interpreter/OptionGroupPlatform.h +++ b/include/lldb/Interpreter/OptionGroupPlatform.h @@ -102,8 +102,10 @@ public: SetSDKBuild (const ConstString &sdk_build) { m_sdk_build = sdk_build; - } - + } + + bool + PlatformMatches(const lldb::PlatformSP &platform_sp) const; protected: std::string m_platform_name; diff --git a/include/lldb/Interpreter/OptionValue.h b/include/lldb/Interpreter/OptionValue.h index 0e8f23453a8aa..787430a96ef5f 100644 --- a/include/lldb/Interpreter/OptionValue.h +++ b/include/lldb/Interpreter/OptionValue.h @@ -17,6 +17,7 @@ #include "lldb/lldb-defines.h" #include "lldb/Core/ConstString.h" #include "lldb/Core/Error.h" +#include "lldb/Core/FormatEntity.h" namespace lldb_private { @@ -45,7 +46,8 @@ namespace lldb_private { eTypeSInt64, eTypeString, eTypeUInt64, - eTypeUUID + eTypeUUID, + eTypeFormatEntity } Type; enum { @@ -309,7 +311,13 @@ namespace lldb_private { const OptionValueUUID * GetAsUUID () const; - + + OptionValueFormatEntity * + GetAsFormatEntity (); + + const OptionValueFormatEntity * + GetAsFormatEntity () const; + bool GetBooleanValue (bool fail_value = false) const; @@ -341,6 +349,9 @@ namespace lldb_private { bool SetFormatValue (lldb::Format new_value); + const FormatEntity::Entry * + GetFormatEntity () const; + const RegularExpression * GetRegexValue () const; diff --git a/include/lldb/Interpreter/OptionValueFormatEntity.h b/include/lldb/Interpreter/OptionValueFormatEntity.h new file mode 100644 index 0000000000000..cc988998bda09 --- /dev/null +++ b/include/lldb/Interpreter/OptionValueFormatEntity.h @@ -0,0 +1,107 @@ +//===-- OptionValueFormatEntity.h --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_OptionValueFormatEntity_h_ +#define liblldb_OptionValueFormatEntity_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/Core/FormatEntity.h" +#include "lldb/Interpreter/OptionValue.h" + +namespace lldb_private { + +class OptionValueFormatEntity : public OptionValue +{ +public: + OptionValueFormatEntity (const char *default_format); + + virtual + ~OptionValueFormatEntity() + { + } + + //--------------------------------------------------------------------- + // Virtual subclass pure virtual overrides + //--------------------------------------------------------------------- + + OptionValue::Type + GetType () const override + { + return eTypeFormatEntity; + } + + void + DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; + + Error + SetValueFromCString (const char *value, + VarSetOperationType op = eVarSetOperationAssign) override; + + bool + Clear () override; + + lldb::OptionValueSP + DeepCopy () const override; + + size_t + AutoComplete (CommandInterpreter &interpreter, + const char *s, + int match_start_point, + int max_return_elements, + bool &word_complete, + StringList &matches) override; + + //--------------------------------------------------------------------- + // Subclass specific functions + //--------------------------------------------------------------------- + + FormatEntity::Entry & + GetCurrentValue() + { + return m_current_entry; + } + + const FormatEntity::Entry & + GetCurrentValue() const + { + return m_current_entry; + } + + void + SetCurrentValue (const FormatEntity::Entry &value) + { + m_current_entry = value; + } + + FormatEntity::Entry & + GetDefaultValue() + { + return m_default_entry; + } + + const FormatEntity::Entry & + GetDefaultValue() const + { + return m_default_entry; + } + + +protected: + std::string m_current_format; + std::string m_default_format; + FormatEntity::Entry m_current_entry; + FormatEntity::Entry m_default_entry; +}; + +} // namespace lldb_private + +#endif // liblldb_OptionValueFormatEntity_h_ diff --git a/include/lldb/Interpreter/OptionValueProperties.h b/include/lldb/Interpreter/OptionValueProperties.h index a67ea5d66e54e..6f7f4995ed159 100644 --- a/include/lldb/Interpreter/OptionValueProperties.h +++ b/include/lldb/Interpreter/OptionValueProperties.h @@ -15,6 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/ConstString.h" +#include "lldb/Core/FormatEntity.h" #include "lldb/Core/UniqueCStringMap.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Interpreter/Property.h" @@ -191,6 +192,9 @@ public: bool SetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value); + const FormatEntity::Entry * + GetPropertyAtIndexAsFormatEntity (const ExecutionContext *exe_ctx, uint32_t idx); + const RegularExpression * GetPropertyAtIndexAsOptionValueRegex (const ExecutionContext *exe_ctx, uint32_t idx) const; diff --git a/include/lldb/Interpreter/OptionValueRegex.h b/include/lldb/Interpreter/OptionValueRegex.h index bb8c4588e22a4..295bb98b69e64 100644 --- a/include/lldb/Interpreter/OptionValueRegex.h +++ b/include/lldb/Interpreter/OptionValueRegex.h @@ -24,9 +24,9 @@ namespace lldb_private { class OptionValueRegex : public OptionValue { public: - OptionValueRegex (const char *value = NULL, uint32_t regex_flags = 0) : + OptionValueRegex (const char *value = NULL) : OptionValue(), - m_regex (value, regex_flags) + m_regex (value) { } @@ -75,10 +75,10 @@ public: } void - SetCurrentValue (const char *value, uint32_t regex_flags) + SetCurrentValue (const char *value) { if (value && value[0]) - m_regex.Compile (value, regex_flags); + m_regex.Compile (value); else m_regex.Clear(); } diff --git a/include/lldb/Interpreter/OptionValues.h b/include/lldb/Interpreter/OptionValues.h index c66fc4dab2f6b..2ccab994674bf 100644 --- a/include/lldb/Interpreter/OptionValues.h +++ b/include/lldb/Interpreter/OptionValues.h @@ -21,6 +21,7 @@ #include "lldb/Interpreter/OptionValueFileSpec.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Interpreter/OptionValueFormat.h" +#include "lldb/Interpreter/OptionValueFormatEntity.h" #include "lldb/Interpreter/OptionValuePathMappings.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Interpreter/OptionValueRegex.h" diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h index 35ba9491ded01..1b4b881619274 100644 --- a/include/lldb/Interpreter/ScriptInterpreter.h +++ b/include/lldb/Interpreter/ScriptInterpreter.h @@ -240,7 +240,13 @@ public: bool m_set_lldb_globals; bool m_maskout_errors; }; - + + virtual bool + Interrupt() + { + return false; + } + virtual bool ExecuteOneLine (const char *command, CommandReturnObject *result, @@ -290,13 +296,13 @@ public: } virtual bool - GenerateTypeScriptFunction (const char* oneliner, std::string& output, void* name_token = NULL) + GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) { return false; } virtual bool - GenerateTypeScriptFunction (StringList &input, std::string& output, void* name_token = NULL) + GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) { return false; } @@ -308,13 +314,13 @@ public: } virtual bool - GenerateTypeSynthClass (StringList &input, std::string& output, void* name_token = NULL) + GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) { return false; } virtual bool - GenerateTypeSynthClass (const char* oneliner, std::string& output, void* name_token = NULL) + GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) { return false; } diff --git a/include/lldb/Interpreter/ScriptInterpreterPython.h b/include/lldb/Interpreter/ScriptInterpreterPython.h index edcc4c44facb6..94ed16e02ca2a 100644 --- a/include/lldb/Interpreter/ScriptInterpreterPython.h +++ b/include/lldb/Interpreter/ScriptInterpreterPython.h @@ -41,125 +41,128 @@ public: ~ScriptInterpreterPython (); bool + Interrupt() override; + + bool ExecuteOneLine (const char *command, CommandReturnObject *result, - const ExecuteScriptOptions &options = ExecuteScriptOptions()); + const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; void - ExecuteInterpreterLoop (); + ExecuteInterpreterLoop () override; bool ExecuteOneLineWithReturn (const char *in_string, ScriptInterpreter::ScriptReturnType return_type, void *ret_value, - const ExecuteScriptOptions &options = ExecuteScriptOptions()); + const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; lldb_private::Error ExecuteMultipleLines (const char *in_string, - const ExecuteScriptOptions &options = ExecuteScriptOptions()); + const ExecuteScriptOptions &options = ExecuteScriptOptions()) override; Error - ExportFunctionDefinitionToInterpreter (StringList &function_def); + ExportFunctionDefinitionToInterpreter (StringList &function_def) override; bool - GenerateTypeScriptFunction (StringList &input, std::string& output, void* name_token = NULL); + GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) override; bool - GenerateTypeSynthClass (StringList &input, std::string& output, void* name_token = NULL); + GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) override; bool - GenerateTypeSynthClass (const char* oneliner, std::string& output, void* name_token = NULL); + GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) override; // use this if the function code is just a one-liner script bool - GenerateTypeScriptFunction (const char* oneliner, std::string& output, void* name_token = NULL); + GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) override; - virtual bool - GenerateScriptAliasFunction (StringList &input, std::string& output); + bool + GenerateScriptAliasFunction (StringList &input, std::string& output) override; lldb::ScriptInterpreterObjectSP CreateSyntheticScriptedProvider (const char *class_name, - lldb::ValueObjectSP valobj); + lldb::ValueObjectSP valobj) override; lldb::ScriptInterpreterObjectSP - virtual CreateScriptedThreadPlan (const char *class_name, - lldb::ThreadPlanSP thread_plan); + CreateScriptedThreadPlan (const char *class_name, + lldb::ThreadPlanSP thread_plan) override; - virtual bool + bool ScriptedThreadPlanExplainsStop (lldb::ScriptInterpreterObjectSP implementor_sp, Event *event, - bool &script_error); - virtual bool + bool &script_error) override; + bool ScriptedThreadPlanShouldStop (lldb::ScriptInterpreterObjectSP implementor_sp, Event *event, - bool &script_error); - virtual lldb::StateType + bool &script_error) override; + lldb::StateType ScriptedThreadPlanGetRunState (lldb::ScriptInterpreterObjectSP implementor_sp, - bool &script_error); + bool &script_error) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP OSPlugin_CreatePluginObject (const char *class_name, - lldb::ProcessSP process_sp); + lldb::ProcessSP process_sp) override; - virtual lldb::ScriptInterpreterObjectSP - OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp); + lldb::ScriptInterpreterObjectSP + OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) override; - virtual lldb::ScriptInterpreterObjectSP - OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp); + lldb::ScriptInterpreterObjectSP + OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP OSPlugin_RegisterContextData (lldb::ScriptInterpreterObjectSP os_plugin_object_sp, - lldb::tid_t thread_id); + lldb::tid_t thread_id) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP OSPlugin_CreateThread (lldb::ScriptInterpreterObjectSP os_plugin_object_sp, lldb::tid_t tid, - lldb::addr_t context); + lldb::addr_t context) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP LoadPluginModule (const FileSpec& file_spec, - lldb_private::Error& error); + lldb_private::Error& error) override; - virtual lldb::ScriptInterpreterObjectSP + lldb::ScriptInterpreterObjectSP GetDynamicSettings (lldb::ScriptInterpreterObjectSP plugin_module_sp, Target* target, const char* setting_name, - lldb_private::Error& error); + lldb_private::Error& error) override; - virtual size_t - CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor); + size_t + CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor) override; - virtual lldb::ValueObjectSP - GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx); + lldb::ValueObjectSP + GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx) override; - virtual int - GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name); + int + GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name) override; - virtual bool - UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor); + bool + UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor) override; - virtual bool - MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor); + bool + MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor) override; - virtual lldb::ValueObjectSP - GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor); + lldb::ValueObjectSP + GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor) override; - virtual bool + bool RunScriptBasedCommand(const char* impl_function, const char* args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject& cmd_retobj, Error& error, - const lldb_private::ExecutionContext& exe_ctx); + const lldb_private::ExecutionContext& exe_ctx) override; Error - GenerateFunction(const char *signature, const StringList &input); + GenerateFunction(const char *signature, const StringList &input) override; Error - GenerateBreakpointCommandCallbackData (StringList &input, std::string& output); + GenerateBreakpointCommandCallbackData (StringList &input, std::string& output) override; bool - GenerateWatchpointCommandCallbackData (StringList &input, std::string& output); + GenerateWatchpointCommandCallbackData (StringList &input, std::string& output) override; // static size_t // GenerateBreakpointOptionsCommandCallback (void *baton, @@ -186,21 +189,21 @@ public: StoppointCallbackContext *context, lldb::user_id_t watch_id); - virtual bool + bool GetScriptedSummary (const char *function_name, lldb::ValueObjectSP valobj, lldb::ScriptInterpreterObjectSP& callee_wrapper_sp, const TypeSummaryOptions& options, - std::string& retval); + std::string& retval) override; - virtual void - Clear (); + void + Clear () override; - virtual bool - GetDocumentationForItem (const char* item, std::string& dest); + bool + GetDocumentationForItem (const char* item, std::string& dest) override; - virtual bool - CheckObjectExists (const char* name) + bool + CheckObjectExists (const char* name) override { if (!name || !name[0]) return false; @@ -208,76 +211,76 @@ public: return GetDocumentationForItem (name,temp); } - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, Process* process, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, Thread* thread, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, Target* target, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, StackFrame* frame, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool RunScriptFormatKeyword (const char* impl_function, ValueObject* value, std::string& output, - Error& error); + Error& error) override; - virtual bool + bool LoadScriptingModule (const char* filename, bool can_reload, bool init_session, lldb_private::Error& error, - lldb::ScriptInterpreterObjectSP* module_sp = nullptr); + lldb::ScriptInterpreterObjectSP* module_sp = nullptr) override; - virtual lldb::ScriptInterpreterObjectSP - MakeScriptObject (void* object); + lldb::ScriptInterpreterObjectSP + MakeScriptObject (void* object) override; - virtual std::unique_ptr<ScriptInterpreterLocker> - AcquireInterpreterLock (); + std::unique_ptr<ScriptInterpreterLocker> + AcquireInterpreterLock () override; void CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec, - CommandReturnObject &result); + CommandReturnObject &result) override; void CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options, - CommandReturnObject &result); + CommandReturnObject &result) override; /// Set the callback body text into the callback for the breakpoint. Error SetBreakpointCommandCallback (BreakpointOptions *bp_options, - const char *callback_body); + const char *callback_body) override; void SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options, - const char *function_name); + const char *function_name) override; /// Set a one-liner as the callback for the watchpoint. void SetWatchpointCommandCallback (WatchpointOptions *wp_options, - const char *oneliner); + const char *oneliner) override; StringList ReadCommandInputFromUser (FILE *in_file); virtual void - ResetOutputFileHandle (FILE *new_fh); + ResetOutputFileHandle (FILE *new_fh) override; static void InitializePrivate (); @@ -331,11 +334,11 @@ public: //---------------------------------------------------------------------- // IOHandlerDelegate //---------------------------------------------------------------------- - virtual void - IOHandlerActivated (IOHandler &io_handler); + void + IOHandlerActivated (IOHandler &io_handler) override; - virtual void - IOHandlerInputComplete (IOHandler &io_handler, std::string &data); + void + IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override; protected: @@ -448,6 +451,26 @@ public: }; protected: + uint32_t + IsExecutingPython () const + { + return m_lock_count > 0; + } + + uint32_t + IncrementLockCount() + { + return ++m_lock_count; + } + + uint32_t + DecrementLockCount() + { + if (m_lock_count > 0) + --m_lock_count; + return m_lock_count; + } + enum ActiveIOHandler { eIOHandlerNone, eIOHandlerBreakpoint, @@ -480,6 +503,7 @@ protected: bool m_session_is_active; bool m_pty_slave_is_open; bool m_valid_session; + uint32_t m_lock_count; PyThreadState *m_command_thread_state; }; } // namespace lldb_private |