diff options
Diffstat (limited to 'contrib/llvm-project/lldb/source/Commands')
29 files changed, 393 insertions, 389 deletions
diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectBreakpoint.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectBreakpoint.cpp index 755cf6c61f26..5d2141d767cb 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -13,6 +13,7 @@ #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupPythonClassWithDict.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index bf0cae51d733..499bc550af45 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/IOHandler.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupPythonClassWithDict.h" @@ -22,36 +23,6 @@ using namespace lldb; using namespace lldb_private; -// FIXME: "script-type" needs to have its contents determined dynamically, so -// somebody can add a new scripting language to lldb and have it pickable here -// without having to change this enumeration by hand and rebuild lldb proper. -static constexpr OptionEnumValueElement g_script_option_enumeration[] = { - { - eScriptLanguageNone, - "command", - "Commands are in the lldb command interpreter language", - }, - { - eScriptLanguagePython, - "python", - "Commands are in the Python language.", - }, - { - eScriptLanguageLua, - "lua", - "Commands are in the Lua language.", - }, - { - eScriptLanguageDefault, - "default-script", - "Commands are in the default scripting language.", - }, -}; - -static constexpr OptionEnumValues ScriptOptionEnum() { - return OptionEnumValues(g_script_option_enumeration); -} - #define LLDB_OPTIONS_breakpoint_command_add #include "CommandOptions.inc" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectCommands.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectCommands.cpp index 39c7207bbdbe..97a883314917 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectCommands.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectCommands.cpp @@ -13,6 +13,7 @@ #include "lldb/Core/IOHandler.h" #include "lldb/Interpreter/CommandHistory.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionValueBoolean.h" @@ -1354,29 +1355,6 @@ protected: CommandOptions m_options; }; -// CommandObjectCommandsScriptAdd -static constexpr OptionEnumValueElement g_script_synchro_type[] = { - { - eScriptedCommandSynchronicitySynchronous, - "synchronous", - "Run synchronous", - }, - { - eScriptedCommandSynchronicityAsynchronous, - "asynchronous", - "Run asynchronous", - }, - { - eScriptedCommandSynchronicityCurrentValue, - "current", - "Do not alter current setting", - }, -}; - -static constexpr OptionEnumValues ScriptSynchroType() { - return OptionEnumValues(g_script_synchro_type); -} - #define LLDB_OPTIONS_script_add #include "CommandOptions.inc" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectDisassemble.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectDisassemble.cpp index 6c33edc8a3a8..a11e2b719727 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -12,6 +12,7 @@ #include "lldb/Core/Module.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/Options.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp index 59c2cdb0938c..0fb50420f70f 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp @@ -14,6 +14,7 @@ #include "lldb/Expression/UserExpression.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Target/Language.h" @@ -28,23 +29,6 @@ CommandObjectExpression::CommandOptions::CommandOptions() = default; CommandObjectExpression::CommandOptions::~CommandOptions() = default; -static constexpr OptionEnumValueElement g_description_verbosity_type[] = { - { - eLanguageRuntimeDescriptionDisplayVerbosityCompact, - "compact", - "Only show the description string", - }, - { - eLanguageRuntimeDescriptionDisplayVerbosityFull, - "full", - "Show the full output, including persistent variable's name and type", - }, -}; - -static constexpr OptionEnumValues DescriptionVerbosityTypes() { - return OptionEnumValues(g_description_verbosity_type); -} - #define LLDB_OPTIONS_expression #include "CommandOptions.inc" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp index 9f2c79d84ad4..23954dd3c9fd 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp @@ -13,6 +13,7 @@ #include "lldb/Host/Config.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupFormat.h" @@ -143,10 +144,10 @@ protected: "`frame diagnose --address` is incompatible with other arguments."); return false; } - valobj_sp = frame_sp->GuessValueForAddress(m_options.address.getValue()); + valobj_sp = frame_sp->GuessValueForAddress(m_options.address.value()); } else if (m_options.reg) { valobj_sp = frame_sp->GuessValueForRegisterAndOffset( - m_options.reg.getValue(), m_options.offset.value_or(0)); + m_options.reg.value(), m_options.offset.value_or(0)); } else { StopInfoSP stop_info_sp = thread->GetStopInfo(); if (!stop_info_sp) { diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectHelp.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectHelp.cpp index a2f682049ae0..c7a3bce1408b 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectHelp.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectHelp.cpp @@ -8,6 +8,7 @@ #include "CommandObjectHelp.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" using namespace lldb; diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectLog.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectLog.cpp index 684cb35da1cc..89bc3e0f1b7d 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectLog.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectLog.cpp @@ -9,6 +9,7 @@ #include "CommandObjectLog.h" #include "lldb/Core/Debugger.h" #include "lldb/Host/OptionParser.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionValueEnumeration.h" @@ -23,36 +24,6 @@ using namespace lldb; using namespace lldb_private; -static constexpr OptionEnumValueElement g_log_handler_type[] = { - { - eLogHandlerDefault, - "default", - "Use the default (stream) log handler", - }, - { - eLogHandlerStream, - "stream", - "Write log messages to the debugger output stream or to a file if one " - "is specified. A buffer size (in bytes) can be specified with -b. If " - "no buffer size is specified the output is unbuffered.", - }, - { - eLogHandlerCircular, - "circular", - "Write log messages to a fixed size circular buffer. A buffer size " - "(number of messages) must be specified with -b.", - }, - { - eLogHandlerSystem, - "os", - "Write log messages to the operating system log.", - }, -}; - -static constexpr OptionEnumValues LogHandlerType() { - return OptionEnumValues(g_log_handler_type); -} - #define LLDB_OPTIONS_log_enable #include "CommandOptions.inc" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp index 98fa38f25635..ca0384cf9453 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp @@ -13,6 +13,7 @@ #include "lldb/Core/ValueObjectMemory.h" #include "lldb/Expression/ExpressionVariable.h" #include "lldb/Host/OptionParser.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupFormat.h" @@ -274,7 +275,7 @@ public: OptionValueUInt64 m_num_per_line; bool m_output_as_binary = false; OptionValueString m_view_as_type; - bool m_force; + bool m_force = false; OptionValueUInt64 m_offset; OptionValueLanguage m_language_for_type; }; @@ -1738,7 +1739,7 @@ protected: const llvm::Optional<std::vector<addr_t>> &dirty_page_list = range_info.GetDirtyPageList(); if (dirty_page_list) { - const size_t page_count = dirty_page_list.getValue().size(); + const size_t page_count = dirty_page_list.value().size(); result.AppendMessageWithFormat( "Modified memory (dirty) page list provided, %zu entries.\n", page_count); diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectMemoryTag.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectMemoryTag.cpp index 67461cac5a29..98ab6201711d 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectMemoryTag.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectMemoryTag.cpp @@ -8,6 +8,7 @@ #include "CommandObjectMemoryTag.h" #include "lldb/Host/OptionParser.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupFormat.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectPlatform.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectPlatform.cpp index 42b19db5efc4..98c6a3b2dd30 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectPlatform.cpp @@ -13,6 +13,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandOptionValidators.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionGroupFile.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectProcess.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectProcess.cpp index d36a574aba7d..28a99ea3d94a 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectProcess.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectProcess.cpp @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "CommandObjectProcess.h" -#include "CommandObjectTrace.h" #include "CommandObjectBreakpoint.h" +#include "CommandObjectTrace.h" #include "CommandOptionsProcessLaunch.h" #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointIDList.h" @@ -19,6 +19,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupPythonClassWithDict.h" @@ -1332,20 +1333,6 @@ protected: } }; -// CommandObjectProcessSaveCore -#pragma mark CommandObjectProcessSaveCore - -static constexpr OptionEnumValueElement g_corefile_save_style[] = { - {eSaveCoreFull, "full", "Create a core file with all memory saved"}, - {eSaveCoreDirtyOnly, "modified-memory", - "Create a corefile with only modified memory saved"}, - {eSaveCoreStackOnly, "stack", - "Create a corefile with only stack memory saved"}}; - -static constexpr OptionEnumValues SaveCoreStyles() { - return OptionEnumValues(g_corefile_save_style); -} - #define LLDB_OPTIONS_process_save_core #include "CommandOptions.inc" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectRegister.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectRegister.cpp index 933c243dedd5..56cbacbebec5 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectRegister.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectRegister.cpp @@ -10,6 +10,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/DumpRegisterValue.h" #include "lldb/Host/OptionParser.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionGroupFormat.h" #include "lldb/Interpreter/OptionValueArray.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectReproducer.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectReproducer.cpp index 8d12decba974..6160a83b4d09 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectReproducer.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectReproducer.cpp @@ -11,6 +11,7 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Utility/GDBRemote.h" @@ -24,95 +25,9 @@ using namespace llvm; using namespace lldb_private; using namespace lldb_private::repro; -enum ReproducerProvider { - eReproducerProviderCommands, - eReproducerProviderFiles, - eReproducerProviderSymbolFiles, - eReproducerProviderGDB, - eReproducerProviderProcessInfo, - eReproducerProviderVersion, - eReproducerProviderWorkingDirectory, - eReproducerProviderHomeDirectory, - eReproducerProviderNone -}; - -static constexpr OptionEnumValueElement g_reproducer_provider_type[] = { - { - eReproducerProviderCommands, - "commands", - "Command Interpreter Commands", - }, - { - eReproducerProviderFiles, - "files", - "Files", - }, - { - eReproducerProviderSymbolFiles, - "symbol-files", - "Symbol Files", - }, - { - eReproducerProviderGDB, - "gdb", - "GDB Remote Packets", - }, - { - eReproducerProviderProcessInfo, - "processes", - "Process Info", - }, - { - eReproducerProviderVersion, - "version", - "Version", - }, - { - eReproducerProviderWorkingDirectory, - "cwd", - "Working Directory", - }, - { - eReproducerProviderHomeDirectory, - "home", - "Home Directory", - }, - { - eReproducerProviderNone, - "none", - "None", - }, -}; - -static constexpr OptionEnumValues ReproducerProviderType() { - return OptionEnumValues(g_reproducer_provider_type); -} - #define LLDB_OPTIONS_reproducer_dump #include "CommandOptions.inc" -enum ReproducerCrashSignal { - eReproducerCrashSigill, - eReproducerCrashSigsegv, -}; - -static constexpr OptionEnumValueElement g_reproducer_signaltype[] = { - { - eReproducerCrashSigill, - "SIGILL", - "Illegal instruction", - }, - { - eReproducerCrashSigsegv, - "SIGSEGV", - "Segmentation fault", - }, -}; - -static constexpr OptionEnumValues ReproducerSignalType() { - return OptionEnumValues(g_reproducer_signaltype); -} - #define LLDB_OPTIONS_reproducer_xcrash #include "CommandOptions.inc" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectScript.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectScript.cpp index f53d6540bc04..2ed03e85b2d7 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectScript.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectScript.cpp @@ -12,6 +12,7 @@ #include "lldb/Host/Config.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/ScriptInterpreter.h" @@ -20,28 +21,6 @@ using namespace lldb; using namespace lldb_private; -static constexpr OptionEnumValueElement g_script_option_enumeration[] = { - { - eScriptLanguagePython, - "python", - "Python", - }, - { - eScriptLanguageLua, - "lua", - "Lua", - }, - { - eScriptLanguageNone, - "default", - "The default scripting language.", - }, -}; - -static constexpr OptionEnumValues ScriptOptionEnum() { - return OptionEnumValues(g_script_option_enumeration); -} - #define LLDB_OPTIONS_script #include "CommandOptions.inc" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectSession.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectSession.cpp index c11839a48de0..f9ef1eb93443 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectSession.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectSession.cpp @@ -1,6 +1,7 @@ #include "CommandObjectSession.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionValue.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectSettings.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectSettings.cpp index e4162e56dc2c..86194664bf5d 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectSettings.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectSettings.cpp @@ -13,6 +13,7 @@ #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionValueProperties.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectSource.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectSource.cpp index f87981859844..fd028d4f62f2 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectSource.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectSource.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/SourceManager.h" #include "lldb/Host/OptionParser.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionValueFileColonLine.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectStats.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectStats.cpp index 63aa36b39f4d..c0f8ff4b0b58 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectStats.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectStats.cpp @@ -9,6 +9,7 @@ #include "CommandObjectStats.h" #include "lldb/Core/Debugger.h" #include "lldb/Host/OptionParser.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Target/Target.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp index 51978878c8b9..3dcb35557bfe 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectTarget.cpp @@ -17,6 +17,7 @@ #include "lldb/DataFormatters/ValueObjectPrinter.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupArchitecture.h" @@ -142,26 +143,6 @@ static uint32_t DumpTargetList(TargetList &target_list, return num_targets; } -// Note that the negation in the argument name causes a slightly confusing -// mapping of the enum values. -static constexpr OptionEnumValueElement g_dependents_enumeration[] = { - { - eLoadDependentsDefault, - "default", - "Only load dependents when the target is an executable.", - }, - { - eLoadDependentsNo, - "true", - "Don't load dependents, even if the target is an executable.", - }, - { - eLoadDependentsYes, - "false", - "Load dependents, even if the target is not an executable.", - }, -}; - #define LLDB_OPTIONS_target_dependents #include "CommandOptions.inc" @@ -1923,26 +1904,6 @@ protected: } }; -#pragma mark CommandObjectTargetModulesDumpSymtab - -static constexpr OptionEnumValueElement g_sort_option_enumeration[] = { - { - eSortOrderNone, - "none", - "No sorting, use the original symbol table order.", - }, - { - eSortOrderByAddress, - "address", - "Sort output by symbol address.", - }, - { - eSortOrderByName, - "name", - "Sort output by symbol name.", - }, -}; - #define LLDB_OPTIONS_target_modules_dump_symtab #include "CommandOptions.inc" @@ -4655,7 +4616,7 @@ public: m_class_name.clear(); m_function_name.clear(); m_line_start = 0; - m_line_end = UINT_MAX; + m_line_end = LLDB_INVALID_LINE_NUMBER; m_file_name.clear(); m_module_name.clear(); m_func_name_type_mask = eFunctionNameTypeAuto; @@ -4676,23 +4637,23 @@ public: std::string m_class_name; std::string m_function_name; uint32_t m_line_start = 0; - uint32_t m_line_end; + uint32_t m_line_end = LLDB_INVALID_LINE_NUMBER; std::string m_file_name; std::string m_module_name; uint32_t m_func_name_type_mask = eFunctionNameTypeAuto; // A pick from lldb::FunctionNameType. - lldb::tid_t m_thread_id; - uint32_t m_thread_index; + lldb::tid_t m_thread_id = LLDB_INVALID_THREAD_ID; + uint32_t m_thread_index = UINT32_MAX; std::string m_thread_name; std::string m_queue_name; bool m_sym_ctx_specified = false; - bool m_no_inlines; + bool m_no_inlines = false; bool m_thread_specified = false; // Instance variables to hold the values for one_liner options. bool m_use_one_liner = false; std::vector<std::string> m_one_liner; - bool m_auto_continue; + bool m_auto_continue = false; }; CommandObjectTargetStopHookAdd(CommandInterpreter &interpreter) diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectThread.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectThread.cpp index ad49d27bb9a7..1371b9dbda1e 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectThread.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectThread.cpp @@ -17,6 +17,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupPythonClassWithDict.h" @@ -239,16 +240,6 @@ protected: enum StepScope { eStepScopeSource, eStepScopeInstruction }; -static constexpr OptionEnumValueElement g_tri_running_mode[] = { - {eOnlyThisThread, "this-thread", "Run only this thread"}, - {eAllThreads, "all-threads", "Run all threads"}, - {eOnlyDuringStepping, "while-stepping", - "Run only this thread while stepping"}}; - -static constexpr OptionEnumValues TriRunningModes() { - return OptionEnumValues(g_tri_running_mode); -} - #define LLDB_OPTIONS_thread_step_scope #include "CommandOptions.inc" @@ -813,14 +804,6 @@ public: // CommandObjectThreadUntil -static constexpr OptionEnumValueElement g_duo_running_mode[] = { - {eOnlyThisThread, "this-thread", "Run only this thread"}, - {eAllThreads, "all-threads", "Run all threads"}}; - -static constexpr OptionEnumValues DuoRunningModes() { - return OptionEnumValues(g_duo_running_mode); -} - #define LLDB_OPTIONS_thread_until #include "CommandOptions.inc" @@ -894,8 +877,8 @@ public: return llvm::makeArrayRef(g_thread_until_options); } - uint32_t m_step_thread_idx; - bool m_stop_others; + uint32_t m_step_thread_idx = LLDB_INVALID_THREAD_ID; + bool m_stop_others = false; std::vector<lldb::addr_t> m_until_addrs; // Instance variables to hold the values for command options. diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectTrace.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectTrace.cpp index 227de2de7065..eaf99a46b5c2 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectTrace.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectTrace.cpp @@ -16,6 +16,7 @@ #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObject.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupFormat.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectType.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectType.cpp index 3ad3571b390c..11acbb5c627f 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectType.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectType.cpp @@ -15,6 +15,7 @@ #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandObject.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupFormat.h" @@ -119,12 +120,12 @@ private: // Instance variables to hold the values for command options. TypeSummaryImpl::Flags m_flags; - bool m_regex; + bool m_regex = false; std::string m_format_string; ConstString m_name; std::string m_python_script; std::string m_python_function; - bool m_is_add_script; + bool m_is_add_script = false; std::string m_category; }; @@ -1054,6 +1055,15 @@ protected: return false; } + static bool ShouldListItem(llvm::StringRef s, RegularExpression *regex) { + // If we have a regex, it can match two kinds of results: + // - An item created with that same regex string (exact string match), so + // the user can list it using the same string it used at creation time. + // - Items that match the regex. + // No regex means list everything. + return regex == nullptr || s == regex->GetText() || regex->Execute(s); + } + bool DoExecute(Args &command, CommandReturnObject &result) override { const size_t argc = command.GetArgumentCount(); @@ -1095,24 +1105,13 @@ protected: .SetExact([&result, &formatter_regex, &any_printed]( const TypeMatcher &type_matcher, const FormatterSharedPointer &format_sp) -> bool { - if (formatter_regex) { - bool escape = true; - if (type_matcher.CreatedBySameMatchString( - ConstString(formatter_regex->GetText()))) { - escape = false; - } else if (formatter_regex->Execute( - type_matcher.GetMatchString().GetStringRef())) { - escape = false; - } - - if (escape) - return true; + if (ShouldListItem(type_matcher.GetMatchString().GetStringRef(), + formatter_regex.get())) { + any_printed = true; + result.GetOutputStream().Printf( + "%s: %s\n", type_matcher.GetMatchString().GetCString(), + format_sp->GetDescription().c_str()); } - - any_printed = true; - result.GetOutputStream().Printf( - "%s: %s\n", type_matcher.GetMatchString().GetCString(), - format_sp->GetDescription().c_str()); return true; }); @@ -1120,24 +1119,13 @@ protected: .SetWithRegex([&result, &formatter_regex, &any_printed]( const TypeMatcher &type_matcher, const FormatterSharedPointer &format_sp) -> bool { - if (formatter_regex) { - bool escape = true; - if (type_matcher.CreatedBySameMatchString( - ConstString(formatter_regex->GetText()))) { - escape = false; - } else if (formatter_regex->Execute( - type_matcher.GetMatchString().GetStringRef())) { - escape = false; - } - - if (escape) - return true; + if (ShouldListItem(type_matcher.GetMatchString().GetStringRef(), + formatter_regex.get())) { + any_printed = true; + result.GetOutputStream().Printf( + "%s: %s\n", type_matcher.GetMatchString().GetCString(), + format_sp->GetDescription().c_str()); } - - any_printed = true; - result.GetOutputStream().Printf( - "%s: %s\n", type_matcher.GetMatchString().GetCString(), - format_sp->GetDescription().c_str()); return true; }); @@ -1154,20 +1142,9 @@ protected: DataVisualization::Categories::ForEach( [&category_regex, &category_closure]( const lldb::TypeCategoryImplSP &category) -> bool { - if (category_regex) { - bool escape = true; - if (category->GetName() == category_regex->GetText()) { - escape = false; - } else if (category_regex->Execute(category->GetName())) { - escape = false; - } - - if (escape) - return true; + if (ShouldListItem(category->GetName(), category_regex.get())) { + category_closure(category); } - - category_closure(category); - return true; }); diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectWatchpoint.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectWatchpoint.cpp index 6805ff7f50ae..f87a171daca6 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -18,6 +18,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Symbol/Variable.h" #include "lldb/Symbol/VariableList.h" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index 0cc83275d7ae..3264813b3d53 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -15,6 +15,7 @@ #include "lldb/Core/IOHandler.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandInterpreter.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Target/Target.h" @@ -22,36 +23,6 @@ using namespace lldb; using namespace lldb_private; -// FIXME: "script-type" needs to have its contents determined dynamically, so -// somebody can add a new scripting language to lldb and have it pickable here -// without having to change this enumeration by hand and rebuild lldb proper. -static constexpr OptionEnumValueElement g_script_option_enumeration[] = { - { - eScriptLanguageNone, - "command", - "Commands are in the lldb command interpreter language", - }, - { - eScriptLanguagePython, - "python", - "Commands are in the Python language.", - }, - { - eScriptLanguageLua, - "lua", - "Commands are in the Lua language.", - }, - { - eSortOrderByName, - "default-script", - "Commands are in the default scripting language.", - }, -}; - -static constexpr OptionEnumValues ScriptOptionEnum() { - return OptionEnumValues(g_script_option_enumeration); -} - #define LLDB_OPTIONS_watchpoint_command_add #include "CommandOptions.inc" diff --git a/contrib/llvm-project/lldb/source/Commands/CommandOptionArgumentTable.cpp b/contrib/llvm-project/lldb/source/Commands/CommandOptionArgumentTable.cpp new file mode 100644 index 000000000000..e8e9307b6291 --- /dev/null +++ b/contrib/llvm-project/lldb/source/Commands/CommandOptionArgumentTable.cpp @@ -0,0 +1,313 @@ +//===-- CommandOptionArgumentTable.cpp ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "lldb/Interpreter/CommandOptionArgumentTable.h" +#include "lldb/DataFormatters/FormatManager.h" +#include "lldb/Target/Language.h" +#include "lldb/Utility/StreamString.h" + +using namespace lldb; +using namespace lldb_private; + +namespace lldb_private { +llvm::StringRef RegisterNameHelpTextCallback() { + return "Register names can be specified using the architecture specific " + "names. " + "They can also be specified using generic names. Not all generic " + "entities have " + "registers backing them on all architectures. When they don't the " + "generic name " + "will return an error.\n" + "The generic names defined in lldb are:\n" + "\n" + "pc - program counter register\n" + "ra - return address register\n" + "fp - frame pointer register\n" + "sp - stack pointer register\n" + "flags - the flags register\n" + "arg{1-6} - integer argument passing registers.\n"; +} + +llvm::StringRef BreakpointIDHelpTextCallback() { + return "Breakpoints are identified using major and minor numbers; the major " + "number corresponds to the single entity that was created with a " + "'breakpoint " + "set' command; the minor numbers correspond to all the locations that " + "were " + "actually found/set based on the major breakpoint. A full breakpoint " + "ID might " + "look like 3.14, meaning the 14th location set for the 3rd " + "breakpoint. You " + "can specify all the locations of a breakpoint by just indicating the " + "major " + "breakpoint number. A valid breakpoint ID consists either of just the " + "major " + "number, or the major number followed by a dot and the location " + "number (e.g. " + "3 or 3.2 could both be valid breakpoint IDs.)"; +} + +llvm::StringRef BreakpointIDRangeHelpTextCallback() { + return "A 'breakpoint ID list' is a manner of specifying multiple " + "breakpoints. " + "This can be done through several mechanisms. The easiest way is to " + "just " + "enter a space-separated list of breakpoint IDs. To specify all the " + "breakpoint locations under a major breakpoint, you can use the major " + "breakpoint number followed by '.*', eg. '5.*' means all the " + "locations under " + "breakpoint 5. You can also indicate a range of breakpoints by using " + "<start-bp-id> - <end-bp-id>. The start-bp-id and end-bp-id for a " + "range can " + "be any valid breakpoint IDs. It is not legal, however, to specify a " + "range " + "using specific locations that cross major breakpoint numbers. I.e. " + "3.2 - 3.7" + " is legal; 2 - 5 is legal; but 3.2 - 4.4 is not legal."; +} + +llvm::StringRef BreakpointNameHelpTextCallback() { + return "A name that can be added to a breakpoint when it is created, or " + "later " + "on with the \"breakpoint name add\" command. " + "Breakpoint names can be used to specify breakpoints in all the " + "places breakpoint IDs " + "and breakpoint ID ranges can be used. As such they provide a " + "convenient way to group breakpoints, " + "and to operate on breakpoints you create without having to track the " + "breakpoint number. " + "Note, the attributes you set when using a breakpoint name in a " + "breakpoint command don't " + "adhere to the name, but instead are set individually on all the " + "breakpoints currently tagged with that " + "name. Future breakpoints " + "tagged with that name will not pick up the attributes previously " + "given using that name. " + "In order to distinguish breakpoint names from breakpoint IDs and " + "ranges, " + "names must start with a letter from a-z or A-Z and cannot contain " + "spaces, \".\" or \"-\". " + "Also, breakpoint names can only be applied to breakpoints, not to " + "breakpoint locations."; +} + +llvm::StringRef GDBFormatHelpTextCallback() { + return "A GDB format consists of a repeat count, a format letter and a size " + "letter. " + "The repeat count is optional and defaults to 1. The format letter is " + "optional " + "and defaults to the previous format that was used. The size letter " + "is optional " + "and defaults to the previous size that was used.\n" + "\n" + "Format letters include:\n" + "o - octal\n" + "x - hexadecimal\n" + "d - decimal\n" + "u - unsigned decimal\n" + "t - binary\n" + "f - float\n" + "a - address\n" + "i - instruction\n" + "c - char\n" + "s - string\n" + "T - OSType\n" + "A - float as hex\n" + "\n" + "Size letters include:\n" + "b - 1 byte (byte)\n" + "h - 2 bytes (halfword)\n" + "w - 4 bytes (word)\n" + "g - 8 bytes (giant)\n" + "\n" + "Example formats:\n" + "32xb - show 32 1 byte hexadecimal integer values\n" + "16xh - show 16 2 byte hexadecimal integer values\n" + "64 - show 64 2 byte hexadecimal integer values (format and size " + "from the last format)\n" + "dw - show 1 4 byte decimal integer value\n"; +} + +llvm::StringRef FormatHelpTextCallback() { + static std::string help_text; + + if (!help_text.empty()) + return help_text; + + StreamString sstr; + sstr << "One of the format names (or one-character names) that can be used " + "to show a variable's value:\n"; + for (Format f = eFormatDefault; f < kNumFormats; f = Format(f + 1)) { + if (f != eFormatDefault) + sstr.PutChar('\n'); + + char format_char = FormatManager::GetFormatAsFormatChar(f); + if (format_char) + sstr.Printf("'%c' or ", format_char); + + sstr.Printf("\"%s\"", FormatManager::GetFormatAsCString(f)); + } + + sstr.Flush(); + + help_text = std::string(sstr.GetString()); + + return help_text; +} + +llvm::StringRef LanguageTypeHelpTextCallback() { + static std::string help_text; + + if (!help_text.empty()) + return help_text; + + StreamString sstr; + sstr << "One of the following languages:\n"; + + Language::PrintAllLanguages(sstr, " ", "\n"); + + sstr.Flush(); + + help_text = std::string(sstr.GetString()); + + return help_text; +} + +llvm::StringRef SummaryStringHelpTextCallback() { + return "A summary string is a way to extract information from variables in " + "order to present them using a summary.\n" + "Summary strings contain static text, variables, scopes and control " + "sequences:\n" + " - Static text can be any sequence of non-special characters, i.e. " + "anything but '{', '}', '$', or '\\'.\n" + " - Variables are sequences of characters beginning with ${, ending " + "with } and that contain symbols in the format described below.\n" + " - Scopes are any sequence of text between { and }. Anything " + "included in a scope will only appear in the output summary if there " + "were no errors.\n" + " - Control sequences are the usual C/C++ '\\a', '\\n', ..., plus " + "'\\$', '\\{' and '\\}'.\n" + "A summary string works by copying static text verbatim, turning " + "control sequences into their character counterpart, expanding " + "variables and trying to expand scopes.\n" + "A variable is expanded by giving it a value other than its textual " + "representation, and the way this is done depends on what comes after " + "the ${ marker.\n" + "The most common sequence if ${var followed by an expression path, " + "which is the text one would type to access a member of an aggregate " + "types, given a variable of that type" + " (e.g. if type T has a member named x, which has a member named y, " + "and if t is of type T, the expression path would be .x.y and the way " + "to fit that into a summary string would be" + " ${var.x.y}). You can also use ${*var followed by an expression path " + "and in that case the object referred by the path will be " + "dereferenced before being displayed." + " If the object is not a pointer, doing so will cause an error. For " + "additional details on expression paths, you can type 'help " + "expr-path'. \n" + "By default, summary strings attempt to display the summary for any " + "variable they reference, and if that fails the value. If neither can " + "be shown, nothing is displayed." + "In a summary string, you can also use an array index [n], or a " + "slice-like range [n-m]. This can have two different meanings " + "depending on what kind of object the expression" + " path refers to:\n" + " - if it is a scalar type (any basic type like int, float, ...) the " + "expression is a bitfield, i.e. the bits indicated by the indexing " + "operator are extracted out of the number" + " and displayed as an individual variable\n" + " - if it is an array or pointer the array items indicated by the " + "indexing operator are shown as the result of the variable. if the " + "expression is an array, real array items are" + " printed; if it is a pointer, the pointer-as-array syntax is used to " + "obtain the values (this means, the latter case can have no range " + "checking)\n" + "If you are trying to display an array for which the size is known, " + "you can also use [] instead of giving an exact range. This has the " + "effect of showing items 0 thru size - 1.\n" + "Additionally, a variable can contain an (optional) format code, as " + "in ${var.x.y%code}, where code can be any of the valid formats " + "described in 'help format', or one of the" + " special symbols only allowed as part of a variable:\n" + " %V: show the value of the object by default\n" + " %S: show the summary of the object by default\n" + " %@: show the runtime-provided object description (for " + "Objective-C, it calls NSPrintForDebugger; for C/C++ it does " + "nothing)\n" + " %L: show the location of the object (memory address or a " + "register name)\n" + " %#: show the number of children of the object\n" + " %T: show the type of the object\n" + "Another variable that you can use in summary strings is ${svar . " + "This sequence works exactly like ${var, including the fact that " + "${*svar is an allowed sequence, but uses" + " the object's synthetic children provider instead of the actual " + "objects. For instance, if you are using STL synthetic children " + "providers, the following summary string would" + " count the number of actual elements stored in an std::list:\n" + "type summary add -s \"${svar%#}\" -x \"std::list<\""; +} + +llvm::StringRef ExprPathHelpTextCallback() { + return "An expression path is the sequence of symbols that is used in C/C++ " + "to access a member variable of an aggregate object (class).\n" + "For instance, given a class:\n" + " class foo {\n" + " int a;\n" + " int b; .\n" + " foo* next;\n" + " };\n" + "the expression to read item b in the item pointed to by next for foo " + "aFoo would be aFoo.next->b.\n" + "Given that aFoo could just be any object of type foo, the string " + "'.next->b' is the expression path, because it can be attached to any " + "foo instance to achieve the effect.\n" + "Expression paths in LLDB include dot (.) and arrow (->) operators, " + "and most commands using expression paths have ways to also accept " + "the star (*) operator.\n" + "The meaning of these operators is the same as the usual one given to " + "them by the C/C++ standards.\n" + "LLDB also has support for indexing ([ ]) in expression paths, and " + "extends the traditional meaning of the square brackets operator to " + "allow bitfield extraction:\n" + "for objects of native types (int, float, char, ...) saying '[n-m]' " + "as an expression path (where n and m are any positive integers, e.g. " + "[3-5]) causes LLDB to extract" + " bits n thru m from the value of the variable. If n == m, [n] is " + "also allowed as a shortcut syntax. For arrays and pointers, " + "expression paths can only contain one index" + " and the meaning of the operation is the same as the one defined by " + "C/C++ (item extraction). Some commands extend bitfield-like syntax " + "for arrays and pointers with the" + " meaning of array slicing (taking elements n thru m inside the array " + "or pointed-to memory)."; +} + +llvm::StringRef arch_helper() { + static StreamString g_archs_help; + if (g_archs_help.Empty()) { + StringList archs; + + ArchSpec::ListSupportedArchNames(archs); + g_archs_help.Printf("These are the supported architecture names:\n"); + archs.Join("\n", g_archs_help); + } + return g_archs_help.GetString(); +} + +template <int I> struct TableValidator : TableValidator<I + 1> { + static_assert( + g_argument_table[I].arg_type == I, + "g_argument_table order doesn't match CommandArgumentType enumeration"); +}; + +template <> struct TableValidator<eArgTypeLastArg> {}; + +TableValidator<0> validator; + +} // namespace lldb_private diff --git a/contrib/llvm-project/lldb/source/Commands/CommandOptionsProcessLaunch.cpp b/contrib/llvm-project/lldb/source/Commands/CommandOptionsProcessLaunch.cpp index a618796156a6..3c7f4b6c7585 100644 --- a/contrib/llvm-project/lldb/source/Commands/CommandOptionsProcessLaunch.cpp +++ b/contrib/llvm-project/lldb/source/Commands/CommandOptionsProcessLaunch.cpp @@ -12,6 +12,8 @@ #include "lldb/Host/HostInfo.h" #include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/CommandCompletions.h" +#include "lldb/Interpreter/CommandObject.h" +#include "lldb/Interpreter/CommandOptionArgumentTable.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Platform.h" diff --git a/contrib/llvm-project/lldb/source/Commands/Options.td b/contrib/llvm-project/lldb/source/Commands/Options.td index 7981917fd8b5..78221db18e65 100644 --- a/contrib/llvm-project/lldb/source/Commands/Options.td +++ b/contrib/llvm-project/lldb/source/Commands/Options.td @@ -3,7 +3,7 @@ include "OptionsBase.td" let Command = "target modules dump symtab" in { def tm_sort : Option<"sort", "s">, Group<1>, Desc<"Supply a sort order when dumping the symbol table.">, - EnumArg<"SortOrder", "OptionEnumValues(g_sort_option_enumeration)">; + EnumArg<"SortOrder">; def tm_smn : Option<"show-mangled-names", "m">, Group<1>, Desc<"Do not demangle symbol names before showing them.">; } @@ -282,7 +282,7 @@ let Command = "breakpoint command add" in { Arg<"Boolean">, Desc<"Specify whether breakpoint command execution should " "terminate on error.">; def breakpoint_add_script_type : Option<"script-type", "s">, - EnumArg<"None", "ScriptOptionEnum()">, + EnumArg<"ScriptLang">, Desc<"Specify the language for the commands - if none is specified, the " "lldb command interpreter will be used.">; def breakpoint_add_dummy_breakpoints : Option<"dummy-breakpoints", "D">, @@ -370,7 +370,7 @@ let Command = "expression" in { "automatically applied to the expression.">; def expression_options_description_verbosity : Option<"description-verbosity", "v">, Group<1>, - OptionalEnumArg<"DescriptionVerbosity", "DescriptionVerbosityTypes()">, + OptionalEnumArg<"DescriptionVerbosity">, Desc<"How verbose should the output of this expression be, if the object " "description is asked for.">; def expression_options_top_level : Option<"top-level", "p">, Groups<[1,2]>, @@ -437,7 +437,7 @@ let Command = "log enable" in { def log_file : Option<"file", "f">, Group<1>, Arg<"Filename">, Desc<"Set the destination file to log to.">; def log_handler : Option<"log-handler", "h">, Group<1>, - EnumArg<"LogHandler", "LogHandlerType()">, Desc<"Specify a log handler which determines where log messages are written.">; + EnumArg<"LogHandler">, Desc<"Specify a log handler which determines where log messages are written.">; def log_buffer_size : Option<"buffer", "b">, Group<1>, Arg<"UnsignedInteger">, Desc<"Set the log to be buffered, using the specified buffer size, if supported by the log handler.">; def log_verbose : Option<"verbose", "v">, Group<1>, @@ -468,7 +468,7 @@ let Command = "log dump" in { let Command = "reproducer dump" in { def reproducer_provider : Option<"provider", "p">, Group<1>, - EnumArg<"None", "ReproducerProviderType()">, + EnumArg<"ReproducerProvider">, Required, Desc<"The reproducer provider to dump.">; def reproducer_file : Option<"file", "f">, Group<1>, Arg<"Filename">, Desc<"The reproducer path. If a reproducer is replayed and no path is " @@ -483,7 +483,7 @@ let Command = "reproducer verify" in { let Command = "reproducer xcrash" in { def reproducer_signal : Option<"signal", "s">, Group<1>, - EnumArg<"None", "ReproducerSignalType()">, + EnumArg<"ReproducerSignal">, Required, Desc<"The signal to crash the debugger.">; } @@ -781,7 +781,7 @@ let Command = "process status" in { let Command = "process save_core" in { def process_save_core_style : Option<"style", "s">, Group<1>, - EnumArg<"SaveCoreStyle", "SaveCoreStyles()">, Desc<"Request a specific style " + EnumArg<"SaveCoreStyle">, Desc<"Request a specific style " "of corefile to be saved.">; def process_save_core_plugin_name : Option<"plugin-name", "p">, OptionalArg<"Plugin">, Desc<"Specify a plugin name to create the core file." @@ -812,7 +812,7 @@ let Command = "script add" in { def script_add_overwrite : Option<"overwrite", "o">, Groups<[1,2]>, Desc<"Overwrite an existing command at this node.">; def script_add_synchronicity : Option<"synchronicity", "s">, - EnumArg<"ScriptedCommandSynchronicity", "ScriptSynchroType()">, + EnumArg<"ScriptedCommandSynchronicity">, Desc<"Set the synchronicity of this command's executions with regard to " "LLDB event system.">; } @@ -828,7 +828,7 @@ let Command = "container add" in { let Command = "script" in { def script_language : Option<"language", "l">, - EnumArg<"ScriptLang", "ScriptOptionEnum()">, Desc<"Specify the scripting " + EnumArg<"ScriptLang">, Desc<"Specify the scripting " " language. If none is specific the default scripting language is used.">; } @@ -881,7 +881,7 @@ let Command = "source list" in { let Command = "target dependents" in { def dependents_no_dependents : Option<"no-dependents", "d">, Group<1>, - OptionalEnumArg<"Value", "OptionEnumValues(g_dependents_enumeration)">, + OptionalEnumArg<"Value">, Desc<"Whether or not to load dependents when creating a target. If the " "option is not specified, the value is implicitly 'default'. If the " "option is specified but without a value, the value is implicitly " @@ -1054,7 +1054,7 @@ let Command = "thread step scope" in { " block. This is particularly use in conjunction with --step-target to" " step through a complex calling sequence.">; def thread_step_scope_run_mode : Option<"run-mode", "m">, Group<1>, - EnumArg<"RunMode", "TriRunningModes()">, Desc<"Determine how to run other " + EnumArg<"RunMode">, Desc<"Determine how to run other " "threads while stepping the current thread.">; def thread_step_scope_step_over_regexp : Option<"step-over-regexp", "r">, Group<1>, Arg<"RegularExpression">, Desc<"A regular expression that defines " @@ -1070,7 +1070,7 @@ let Command = "thread until" in { def thread_until_thread : Option<"thread", "t">, Group<1>, Arg<"ThreadIndex">, Desc<"Thread index for the thread for until operation">; def thread_until_run_mode : Option<"run-mode", "m">, Group<1>, - EnumArg<"RunMode", "DuoRunningModes()">, Desc<"Determine how to run other " + EnumArg<"RunMode">, Desc<"Determine how to run other " "threads while stepping this one">; def thread_until_address : Option<"address", "a">, Group<1>, Arg<"AddressOrExpression">, Desc<"Run until we reach the specified address, " @@ -1333,7 +1333,7 @@ let Command = "watchpoint command add" in { Arg<"Boolean">, Desc<"Specify whether watchpoint command execution should " "terminate on error.">; def watchpoint_command_add_script_type : Option<"script-type", "s">, - EnumArg<"None", "ScriptOptionEnum()">, Desc<"Specify the language for the" + EnumArg<"ScriptLang">, Desc<"Specify the language for the" " commands - if none is specified, the lldb command interpreter will be " "used.">; def watchpoint_command_add_python_function : Option<"python-function", "F">, diff --git a/contrib/llvm-project/lldb/source/Commands/OptionsBase.td b/contrib/llvm-project/lldb/source/Commands/OptionsBase.td index f6967f067bf4..9612cc130334 100644 --- a/contrib/llvm-project/lldb/source/Commands/OptionsBase.td +++ b/contrib/llvm-project/lldb/source/Commands/OptionsBase.td @@ -151,15 +151,13 @@ class Arg<string type> { } // Gives the option an required argument. -class EnumArg<string type, string enum> { +class EnumArg<string type> { string ArgType = type; - string ArgEnum = enum; } // Gives the option an required argument. -class OptionalEnumArg<string type, string enum> { +class OptionalEnumArg<string type> { string ArgType = type; - string ArgEnum = enum; bit OptionalArg = 1; } |