diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectType.cpp')
| -rw-r--r-- | lldb/source/Commands/CommandObjectType.cpp | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index 5e31fd5e8bce..87c107cfb943 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -11,6 +11,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/IOHandler.h" #include "lldb/DataFormatters/DataVisualization.h" +#include "lldb/Host/Config.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObject.h" @@ -23,20 +24,16 @@ #include "lldb/Interpreter/Options.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Target/Language.h" -#include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "lldb/Target/ThreadList.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/RegularExpression.h" -#include "lldb/Utility/State.h" #include "lldb/Utility/StringList.h" #include "llvm/ADT/STLExtras.h" #include <algorithm> -#include <cctype> #include <functional> #include <memory> @@ -162,7 +159,7 @@ public: std::string &data) override { StreamFileSP error_sp = io_handler.GetErrorStreamFileSP(); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); if (interpreter) { StringList lines; @@ -255,7 +252,7 @@ public: "error: script interpreter missing, didn't add python command.\n"); error_sp->Flush(); } -#endif // LLDB_DISABLE_PYTHON +#endif io_handler.SetIsDone(true); } @@ -394,7 +391,7 @@ protected: std::string &data) override { StreamFileSP error_sp = io_handler.GetErrorStreamFileSP(); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); if (interpreter) { StringList lines; @@ -474,7 +471,7 @@ protected: error_sp->Flush(); } -#endif // LLDB_DISABLE_PYTHON +#endif io_handler.SetIsDone(true); } @@ -1059,8 +1056,9 @@ protected: bool any_printed = false; - auto category_closure = [&result, &formatter_regex, &any_printed]( - const lldb::TypeCategoryImplSP &category) -> void { + auto category_closure = + [&result, &formatter_regex, + &any_printed](const lldb::TypeCategoryImplSP &category) -> void { result.GetOutputStream().Printf( "-----------------------\nCategory: %s%s\n-----------------------\n", category->GetName(), category->IsEnabled() ? "" : " (disabled)"); @@ -1166,12 +1164,6 @@ public: "Show a list of current formats.") {} }; -#ifndef LLDB_DISABLE_PYTHON - -// CommandObjectTypeSummaryAdd - -#endif // LLDB_DISABLE_PYTHON - Status CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue( uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { @@ -1254,7 +1246,7 @@ void CommandObjectTypeSummaryAdd::CommandOptions::OptionParsingStarting( m_category = "default"; } -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary( Args &command, CommandReturnObject &result) { @@ -1340,7 +1332,6 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary( m_interpreter.GetPythonCommandsFromIOHandler( " ", // Prompt *this, // IOHandlerDelegate - true, // Run IOHandler in async mode options); // Baton for the "io_handler" that will be passed back into // our IOHandlerDelegate functions result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -1379,7 +1370,7 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary( return result.Succeeded(); } -#endif // LLDB_DISABLE_PYTHON +#endif bool CommandObjectTypeSummaryAdd::Execute_StringSummary( Args &command, CommandReturnObject &result) { @@ -1577,13 +1568,13 @@ bool CommandObjectTypeSummaryAdd::DoExecute(Args &command, WarnOnPotentialUnquotedUnsignedType(command, result); if (m_options.m_is_add_script) { -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON return Execute_ScriptSummary(command, result); #else result.AppendError("python is disabled"); result.SetStatus(eReturnStatusFailed); return false; -#endif // LLDB_DISABLE_PYTHON +#endif } return Execute_StringSummary(command, result); @@ -2151,7 +2142,7 @@ public: "Show a list of current filters.") {} }; -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON // CommandObjectTypeSynthList @@ -2164,7 +2155,7 @@ public: "Show a list of current synthetic providers.") {} }; -#endif // LLDB_DISABLE_PYTHON +#endif // CommandObjectTypeFilterDelete @@ -2179,7 +2170,7 @@ public: ~CommandObjectTypeFilterDelete() override = default; }; -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON // CommandObjectTypeSynthDelete @@ -2195,7 +2186,7 @@ public: ~CommandObjectTypeSynthDelete() override = default; }; -#endif // LLDB_DISABLE_PYTHON +#endif // CommandObjectTypeFilterClear @@ -2208,7 +2199,7 @@ public: "type filter clear", "Delete all existing filter.") {} }; -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON // CommandObjectTypeSynthClear class CommandObjectTypeSynthClear : public CommandObjectTypeFormatterClear { @@ -2240,7 +2231,6 @@ bool CommandObjectTypeSynthAdd::Execute_HandwritePython( m_interpreter.GetPythonCommandsFromIOHandler( " ", // Prompt *this, // IOHandlerDelegate - true, // Run IOHandler in async mode options); // Baton for the "io_handler" that will be passed back into our // IOHandlerDelegate functions result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -2343,9 +2333,9 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name, type = eRegexSynth; } - if (category->AnyMatches(type_name, eFormatCategoryItemFilter | - eFormatCategoryItemRegexFilter, - false)) { + if (category->AnyMatches( + type_name, eFormatCategoryItemFilter | eFormatCategoryItemRegexFilter, + false)) { if (error) error->SetErrorStringWithFormat("cannot add synthetic for type %s when " "filter is defined in same category!", @@ -2372,7 +2362,7 @@ bool CommandObjectTypeSynthAdd::AddSynth(ConstString type_name, } } -#endif // LLDB_DISABLE_PYTHON +#endif #define LLDB_OPTIONS_type_filter_add #include "CommandOptions.inc" @@ -2468,9 +2458,9 @@ private: type = eRegexFilter; } - if (category->AnyMatches(type_name, eFormatCategoryItemSynth | - eFormatCategoryItemRegexSynth, - false)) { + if (category->AnyMatches( + type_name, eFormatCategoryItemSynth | eFormatCategoryItemRegexSynth, + false)) { if (error) error->SetErrorStringWithFormat("cannot add filter for type %s when " "synthetic is defined in same " @@ -2828,8 +2818,7 @@ public: CommandObjectFormatterInfo(CommandInterpreter &interpreter, const char *formatter_name, DiscoveryFunction discovery_func) - : CommandObjectRaw(interpreter, "", "", "", - eCommandRequiresFrame), + : CommandObjectRaw(interpreter, "", "", "", eCommandRequiresFrame), m_formatter_name(formatter_name ? formatter_name : ""), m_discovery_function(discovery_func) { StreamString name; @@ -2923,7 +2912,7 @@ public: ~CommandObjectTypeFormat() override = default; }; -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON class CommandObjectTypeSynth : public CommandObjectMultiword { public: @@ -2952,7 +2941,7 @@ public: ~CommandObjectTypeSynth() override = default; }; -#endif // LLDB_DISABLE_PYTHON +#endif class CommandObjectTypeFilter : public CommandObjectMultiword { public: @@ -3038,10 +3027,10 @@ CommandObjectType::CommandObjectType(CommandInterpreter &interpreter) CommandObjectSP(new CommandObjectTypeFormat(interpreter))); LoadSubCommand("summary", CommandObjectSP(new CommandObjectTypeSummary(interpreter))); -#ifndef LLDB_DISABLE_PYTHON +#if LLDB_ENABLE_PYTHON LoadSubCommand("synthetic", CommandObjectSP(new CommandObjectTypeSynth(interpreter))); -#endif // LLDB_DISABLE_PYTHON +#endif LoadSubCommand("lookup", CommandObjectSP(new CommandObjectTypeLookup(interpreter))); } |
