LLDB mainline
|
A command line option parsing protocol class. More...
#include "lldb/Interpreter/Options.h"
Inherited by CommandObjectBreakpointClear::CommandOptions, CommandObjectBreakpointCommandDelete::CommandOptions, CommandObjectBreakpointDelete::CommandOptions, CommandObjectBreakpointList::CommandOptions, CommandObjectBreakpointRead::CommandOptions, CommandObjectBreakpointWrite::CommandOptions, CommandObjectCommandsAddRegex::CommandOptions, CommandObjectCommandsContainerAdd::CommandOptions, CommandObjectCommandsScriptAdd::CommandOptions, CommandObjectCommandsScriptImport::CommandOptions, CommandObjectCommandsSource::CommandOptions, CommandObjectDiagnosticsDump::CommandOptions, CommandObjectFrameDiagnose::CommandOptions, CommandObjectFrameRecognizerAdd::CommandOptions, CommandObjectFrameSelect::CommandOptions, CommandObjectLogDump::CommandOptions, CommandObjectLogEnable::CommandOptions, CommandObjectObjC_ClassTable_Dump::CommandOptions, CommandObjectPlatformFRead::CommandOptions, CommandObjectPlatformFWrite::CommandOptions, CommandObjectPlatformProcessList::CommandOptions, CommandObjectPlatformShell::CommandOptions, CommandObjectProcessConnect::CommandOptions, CommandObjectProcessContinue::CommandOptions, CommandObjectProcessDetach::CommandOptions, CommandObjectProcessHandle::CommandOptions, CommandObjectProcessLoad::CommandOptions, CommandObjectProcessSaveCore::CommandOptions, CommandObjectProcessStatus::CommandOptions, CommandObjectScriptingExtensionList::CommandOptions, CommandObjectScriptingObjectParsed::CommandOptions, CommandObjectScriptingRun::CommandOptions, CommandObjectSessionHistory::CommandOptions, CommandObjectSettingsClear::CommandOptions, CommandObjectSettingsRead::CommandOptions, CommandObjectSettingsSet::CommandOptions, CommandObjectSettingsWrite::CommandOptions, CommandObjectSourceInfo::CommandOptions, CommandObjectSourceList::CommandOptions, CommandObjectStatsDump::CommandOptions, CommandObjectTargetModulesDumpLineTable::CommandOptions, CommandObjectTargetModulesDumpSeparateDebugInfoFiles::CommandOptions, CommandObjectTargetModulesDumpSymtab::CommandOptions, CommandObjectTargetModulesList::CommandOptions, CommandObjectTargetModulesLookup::CommandOptions, CommandObjectTargetModulesShowUnwind::CommandOptions, CommandObjectThreadBacktrace::CommandOptions, CommandObjectThreadInfo::CommandOptions, CommandObjectThreadJump::CommandOptions, CommandObjectThreadPlanList::CommandOptions, CommandObjectThreadReturn::CommandOptions, CommandObjectThreadUntil::CommandOptions, CommandObjectTraceDump::CommandOptions, CommandObjectTraceDumpFunctionCalls::CommandOptions, CommandObjectTraceDumpInfo::CommandOptions, CommandObjectTraceDumpInstructions::CommandOptions, CommandObjectTraceLoad::CommandOptions, CommandObjectTraceSave::CommandOptions, CommandObjectTraceSchema::CommandOptions, CommandObjectTypeCategoryDefine::CommandOptions, CommandObjectTypeCategoryDisable::CommandOptions, CommandObjectTypeCategoryEnable::CommandOptions, CommandObjectTypeFilterAdd::CommandOptions, CommandObjectTypeFormatterClear::CommandOptions, CommandObjectTypeFormatterDelete::CommandOptions, CommandObjectTypeFormatterList< FormatterType >::CommandOptions, CommandObjectTypeSummaryAdd::CommandOptions, CommandObjectTypeSynthAdd::CommandOptions, CommandObjectWatchpointCommandAdd::CommandOptions, CommandObjectWatchpointDelete::CommandOptions, CommandObjectWatchpointIgnore::CommandOptions, CommandObjectWatchpointList::CommandOptions, CommandObjectWatchpointModify::CommandOptions, lldb_private::CommandObjectDisassemble::CommandOptions, lldb_private::CommandObjectHelp::CommandOptions, lldb_private::OptionGroupOptions, lldb_private::ctf::CommandObjectThreadTraceExportCTF::CommandOptions, lldb_private::trace_intel_pt::CommandObjectProcessTraceStartIntelPT::CommandOptions, lldb_private::trace_intel_pt::CommandObjectThreadTraceStartIntelPT::CommandOptions, and sddarwinlog_private::EnableOptions.
Public Member Functions | |
Options () | |
virtual | ~Options () |
void | BuildGetoptTable () |
void | BuildValidOptionSets () |
uint32_t | NumCommandOptions () |
Option * | GetLongOptions () |
Get the option definitions to use when parsing Args options. | |
void | OptionSeen (int short_option) |
bool | VerifyOptions (CommandReturnObject &result) |
bool | VerifyPartialOptions (CommandReturnObject &result) |
void | OutputFormattedUsageText (Stream &strm, const OptionDefinition &option_def, uint32_t output_max_columns) |
void | GenerateOptionUsage (Stream &strm, CommandObject &cmd, uint32_t screen_width) |
bool | SupportsLongOption (const char *long_option) |
virtual llvm::ArrayRef< OptionDefinition > | GetDefinitions () |
void | NotifyOptionParsingStarting (ExecutionContext *execution_context) |
llvm::Expected< Args > | Parse (const Args &args, ExecutionContext *execution_context, lldb::PlatformSP platform_sp, bool require_validation) |
Parse the provided arguments. | |
llvm::Expected< Args > | ParseAlias (const Args &args, OptionArgVector *option_arg_vector, std::string &input_line) |
OptionElementVector | ParseForCompletion (const Args &args, uint32_t cursor_index) |
Status | NotifyOptionParsingFinished (ExecutionContext *execution_context) |
virtual Status | SetOptionValue (uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context)=0 |
Set the value of an option. | |
bool | HandleOptionCompletion (lldb_private::CompletionRequest &request, OptionElementVector &option_map, CommandInterpreter &interpreter) |
Handles the generic bits of figuring out whether we are in an option, and if so completing it. | |
virtual void | HandleOptionArgumentCompletion (lldb_private::CompletionRequest &request, OptionElementVector &opt_element_vector, int opt_element_index, CommandInterpreter &interpreter) |
Handles the generic bits of figuring out whether we are in an option, and if so completing it. | |
Protected Types | |
typedef std::set< int > | OptionSet |
typedef std::vector< OptionSet > | OptionSetVector |
Protected Member Functions | |
OptionSetVector & | GetRequiredOptions () |
OptionSetVector & | GetOptionalOptions () |
bool | IsASubset (const OptionSet &set_a, const OptionSet &set_b) |
size_t | OptionsSetDiff (const OptionSet &set_a, const OptionSet &set_b, OptionSet &diffs) |
void | OptionsSetUnion (const OptionSet &set_a, const OptionSet &set_b, OptionSet &union_set) |
virtual void | OptionParsingStarting (ExecutionContext *execution_context)=0 |
virtual Status | OptionParsingFinished (ExecutionContext *execution_context) |
Protected Attributes | |
std::vector< Option > | m_getopt_table |
OptionSet | m_seen_options |
OptionSetVector | m_required_options |
OptionSetVector | m_optional_options |
A command line option parsing protocol class.
Options is designed to be subclassed to contain all needed options for a given command. The options can be parsed by calling the Parse function.
The options are specified using the format defined for the libc options parsing function getopt_long_only:
|
protected |
|
protected |
Options::Options | ( | ) |
Definition at line 64 of file Options.cpp.
References BuildValidOptionSets().
|
virtualdefault |
void lldb_private::Options::BuildGetoptTable | ( | ) |
void Options::BuildValidOptionSets | ( | ) |
Definition at line 184 of file Options.cpp.
References GetDefinitions(), LLDB_MAX_NUM_OPTION_SETS, LLDB_OPT_SET_ALL, m_optional_options, m_required_options, and NumCommandOptions().
Referenced by GetOptionalOptions(), GetRequiredOptions(), and Options().
void Options::GenerateOptionUsage | ( | Stream & | strm, |
CommandObject & | cmd, | ||
uint32_t | screen_width | ||
) |
Definition at line 427 of file Options.cpp.
References eDisplayBestOption, eDisplayLongOption, eDisplayShortOption, lldb_private::OptionParser::eNoArgument, lldb_private::OptionDefinition::enum_values, lldb_private::Stream::EOL(), lldb_private::CommandObject::GetCommandName(), GetDefinitions(), lldb_private::CommandObject::GetFormattedCommandArguments(), lldb_private::Stream::GetIndentLevel(), GetRequiredOptions(), lldb_private::StreamString::GetSize(), lldb_private::StreamString::GetString(), lldb_private::OptionDefinition::HasShortOption(), lldb_private::Stream::Indent(), lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), lldb_private::CommandObject::IsDashDashCommand(), NumCommandOptions(), OutputFormattedUsageText(), lldb_private::Stream::Printf(), PrintOption(), lldb_private::Stream::PutChar(), lldb_private::Stream::PutCString(), lldb_private::Stream::SetIndentLevel(), lldb_private::OptionDefinition::short_option, lldb_private::OptionDefinition::usage_text, and lldb_private::CommandObject::WantsRawCommandString().
Referenced by lldb_private::CommandObjectDisassemble::DoExecute(), CommandObjectFrameSelect::DoExecute(), lldb_private::CommandObject::GenerateHelpText(), lldb_private::CommandObject::HelpTextContainsWord(), and CommandObjectTargetModulesLookup::LookupInModule().
|
inlinevirtual |
Reimplemented in lldb_private::OptionGroupOptions, CommandObjectBreakpointList::CommandOptions, CommandObjectBreakpointClear::CommandOptions, CommandObjectBreakpointDelete::CommandOptions, CommandObjectBreakpointRead::CommandOptions, CommandObjectBreakpointWrite::CommandOptions, CommandObjectBreakpointCommandDelete::CommandOptions, CommandObjectCommandsSource::CommandOptions, CommandObjectCommandsAddRegex::CommandOptions, CommandObjectScriptingObjectParsed::CommandOptions, CommandObjectCommandsScriptImport::CommandOptions, CommandObjectCommandsScriptAdd::CommandOptions, CommandObjectCommandsContainerAdd::CommandOptions, CommandObjectDiagnosticsDump::CommandOptions, lldb_private::CommandObjectDisassemble::CommandOptions, CommandObjectFrameDiagnose::CommandOptions, CommandObjectFrameSelect::CommandOptions, CommandObjectFrameRecognizerAdd::CommandOptions, lldb_private::CommandObjectHelp::CommandOptions, CommandObjectLogEnable::CommandOptions, CommandObjectLogDump::CommandOptions, CommandObjectPlatformFRead::CommandOptions, CommandObjectPlatformFWrite::CommandOptions, CommandObjectPlatformProcessList::CommandOptions, CommandObjectPlatformShell::CommandOptions, CommandObjectProcessContinue::CommandOptions, CommandObjectProcessDetach::CommandOptions, CommandObjectProcessConnect::CommandOptions, CommandObjectProcessLoad::CommandOptions, CommandObjectProcessSaveCore::CommandOptions, CommandObjectProcessStatus::CommandOptions, CommandObjectProcessHandle::CommandOptions, CommandObjectScriptingRun::CommandOptions, CommandObjectScriptingExtensionList::CommandOptions, CommandObjectSessionHistory::CommandOptions, CommandObjectSettingsSet::CommandOptions, CommandObjectSettingsWrite::CommandOptions, CommandObjectSettingsRead::CommandOptions, CommandObjectSettingsClear::CommandOptions, CommandObjectSourceInfo::CommandOptions, CommandObjectSourceList::CommandOptions, CommandObjectStatsDump::CommandOptions, CommandObjectTargetModulesDumpSymtab::CommandOptions, CommandObjectTargetModulesDumpLineTable::CommandOptions, CommandObjectTargetModulesDumpSeparateDebugInfoFiles::CommandOptions, CommandObjectTargetModulesList::CommandOptions, CommandObjectTargetModulesShowUnwind::CommandOptions, CommandObjectTargetModulesLookup::CommandOptions, CommandObjectThreadBacktrace::CommandOptions, CommandObjectThreadUntil::CommandOptions, CommandObjectThreadInfo::CommandOptions, CommandObjectThreadReturn::CommandOptions, CommandObjectThreadJump::CommandOptions, CommandObjectThreadPlanList::CommandOptions, CommandObjectTraceDumpFunctionCalls::CommandOptions, CommandObjectTraceDumpInstructions::CommandOptions, CommandObjectTraceDumpInfo::CommandOptions, CommandObjectTraceSave::CommandOptions, CommandObjectTraceLoad::CommandOptions, CommandObjectTraceDump::CommandOptions, CommandObjectTraceSchema::CommandOptions, CommandObjectTypeSummaryAdd::CommandOptions, CommandObjectTypeSynthAdd::CommandOptions, CommandObjectTypeFormatterDelete::CommandOptions, CommandObjectTypeFormatterClear::CommandOptions, CommandObjectTypeFormatterList< FormatterType >::CommandOptions, CommandObjectTypeCategoryDefine::CommandOptions, CommandObjectTypeCategoryEnable::CommandOptions, CommandObjectTypeCategoryDisable::CommandOptions, CommandObjectTypeFilterAdd::CommandOptions, CommandObjectWatchpointList::CommandOptions, CommandObjectWatchpointDelete::CommandOptions, CommandObjectWatchpointIgnore::CommandOptions, CommandObjectWatchpointModify::CommandOptions, CommandObjectWatchpointCommandAdd::CommandOptions, CommandObjectObjC_ClassTable_Dump::CommandOptions, sddarwinlog_private::EnableOptions, lldb_private::trace_intel_pt::CommandObjectThreadTraceStartIntelPT::CommandOptions, lldb_private::trace_intel_pt::CommandObjectProcessTraceStartIntelPT::CommandOptions, and lldb_private::ctf::CommandObjectThreadTraceExportCTF::CommandOptions.
Definition at line 98 of file Options.h.
Referenced by BuildValidOptionSets(), GenerateOptionUsage(), GetLongOptions(), CommandObjectScriptingObjectParsed::HandleArgumentCompletion(), HandleOptionArgumentCompletion(), HandleOptionCompletion(), NumCommandOptions(), ParseForCompletion(), and SupportsLongOption().
Option * Options::GetLongOptions | ( | ) |
Get the option definitions to use when parsing Args options.
Definition at line 237 of file Options.cpp.
References GetDefinitions(), m_getopt_table, and lldb_private::Debugger::ReportError().
Referenced by Parse(), ParseAlias(), and ParseForCompletion().
|
inlineprotected |
Definition at line 208 of file Options.h.
References BuildValidOptionSets(), and m_optional_options.
Referenced by VerifyOptions(), and VerifyPartialOptions().
|
inlineprotected |
Definition at line 203 of file Options.h.
References BuildValidOptionSets(), and m_required_options.
Referenced by GenerateOptionUsage(), VerifyOptions(), and VerifyPartialOptions().
|
virtual |
Handles the generic bits of figuring out whether we are in an option, and if so completing it.
[in,out] | request | The completion request that we need to act upon. |
[in] | interpreter | The command interpreter doing the completion. |
Reimplemented in CommandObjectBreakpointRead::CommandOptions, and CommandObjectScriptingObjectParsed::CommandOptions.
Definition at line 716 of file Options.cpp.
References lldb_private::CommandObject::ArgumentTableEntry::completion_type, lldb::eArgTypeNone, lldb_private::OptionArgElement::eBareDash, lldb_private::OptionArgElement::eBareDoubleDash, lldb::eSourceFileCompletion, lldb::eSymbolCompletion, lldb_private::OptionArgElement::eUnrecognizedArg, lldb_private::CommandObject::FindArgumentDataByType(), lldb_private::Args::GetArgumentAtIndex(), lldb_private::CommandInterpreter::GetDebugger(), GetDefinitions(), lldb_private::CompletionRequest::GetParsedLine(), lldb_private::Debugger::GetSelectedTarget(), lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(), and lldb_private::CompletionRequest::TryCompleteCurrentArg().
Referenced by CommandObjectScriptingObjectParsed::CommandOptions::HandleOptionArgumentCompletion(), and HandleOptionCompletion().
bool Options::HandleOptionCompletion | ( | lldb_private::CompletionRequest & | request, |
OptionElementVector & | option_map, | ||
CommandInterpreter & | interpreter | ||
) |
Handles the generic bits of figuring out whether we are in an option, and if so completing it.
[in,out] | request | The completion request that we need to act upon. |
[in] | interpreter | The interpreter that's doing the completing. |
FIXME: This is the wrong return value, since we also need to make a distinction between total number of matches, and the window the user wants returned.
Definition at line 619 of file Options.cpp.
References lldb_private::CompletionRequest::AddCompletion(), lldb_private::OptionArgElement::eBareDash, lldb_private::OptionArgElement::eBareDoubleDash, lldb_private::OptionArgElement::eUnrecognizedArg, lldb_private::CompletionRequest::GetCursorArgumentPrefix(), lldb_private::CompletionRequest::GetCursorIndex(), GetDefinitions(), HandleOptionArgumentCompletion(), lldb_private::OptionDefinition::long_option, and lldb_private::OptionDefinition::usage_text.
Referenced by lldb_private::CommandObject::HandleCompletion().
Definition at line 83 of file Options.cpp.
Referenced by VerifyOptions(), and VerifyPartialOptions().
Status Options::NotifyOptionParsingFinished | ( | ExecutionContext * | execution_context | ) |
Definition at line 75 of file Options.cpp.
References OptionParsingFinished().
Referenced by lldb_private::CommandObject::ParseOptions(), and lldb_private::CommandObject::ParseOptionsAndNotify().
void Options::NotifyOptionParsingStarting | ( | ExecutionContext * | execution_context | ) |
Definition at line 68 of file Options.cpp.
References m_seen_options, and OptionParsingStarting().
Referenced by lldb_private::CommandObjectDWIMPrint::DoExecute(), CommandObjectPlatformShell::DoExecute(), lldb_private::CommandObject::ParseOptions(), and ProcessAliasOptionsArgs().
uint32_t Options::NumCommandOptions | ( | ) |
Definition at line 235 of file Options.cpp.
References GetDefinitions().
Referenced by BuildValidOptionSets(), lldb_private::CommandObject::GenerateHelpText(), and GenerateOptionUsage().
|
inlineprotectedvirtual |
Reimplemented in lldb_private::OptionGroupOptions, lldb_private::CommandObjectDisassemble::CommandOptions, and CommandObjectTargetModulesLookup::CommandOptions.
Definition at line 226 of file Options.h.
References error().
Referenced by NotifyOptionParsingFinished(), and CommandObjectScriptingObjectParsed::CommandOptions::PrepareOptionsForCompletion().
|
protectedpure virtual |
Implemented in lldb_private::OptionGroupOptions, CommandObjectBreakpointList::CommandOptions, CommandObjectBreakpointClear::CommandOptions, CommandObjectBreakpointDelete::CommandOptions, CommandObjectBreakpointRead::CommandOptions, CommandObjectBreakpointWrite::CommandOptions, CommandObjectBreakpointCommandDelete::CommandOptions, CommandObjectCommandsSource::CommandOptions, CommandObjectCommandsAddRegex::CommandOptions, CommandObjectScriptingObjectParsed::CommandOptions, CommandObjectCommandsScriptImport::CommandOptions, CommandObjectCommandsScriptAdd::CommandOptions, CommandObjectCommandsContainerAdd::CommandOptions, CommandObjectDiagnosticsDump::CommandOptions, lldb_private::CommandObjectDisassemble::CommandOptions, CommandObjectFrameDiagnose::CommandOptions, CommandObjectFrameSelect::CommandOptions, CommandObjectFrameRecognizerAdd::CommandOptions, lldb_private::CommandObjectHelp::CommandOptions, CommandObjectLogEnable::CommandOptions, CommandObjectLogDump::CommandOptions, CommandObjectPlatformFRead::CommandOptions, CommandObjectPlatformFWrite::CommandOptions, CommandObjectPlatformProcessList::CommandOptions, CommandObjectPlatformShell::CommandOptions, CommandObjectProcessContinue::CommandOptions, CommandObjectProcessDetach::CommandOptions, CommandObjectProcessConnect::CommandOptions, CommandObjectProcessLoad::CommandOptions, CommandObjectProcessSaveCore::CommandOptions, CommandObjectProcessStatus::CommandOptions, CommandObjectProcessHandle::CommandOptions, CommandObjectScriptingRun::CommandOptions, CommandObjectScriptingExtensionList::CommandOptions, CommandObjectSessionHistory::CommandOptions, CommandObjectSettingsSet::CommandOptions, CommandObjectSettingsWrite::CommandOptions, CommandObjectSettingsRead::CommandOptions, CommandObjectSettingsClear::CommandOptions, CommandObjectSourceInfo::CommandOptions, CommandObjectSourceList::CommandOptions, CommandObjectStatsDump::CommandOptions, CommandObjectTargetModulesDumpSymtab::CommandOptions, CommandObjectTargetModulesDumpLineTable::CommandOptions, CommandObjectTargetModulesDumpSeparateDebugInfoFiles::CommandOptions, CommandObjectTargetModulesList::CommandOptions, CommandObjectTargetModulesShowUnwind::CommandOptions, CommandObjectTargetModulesLookup::CommandOptions, CommandObjectThreadBacktrace::CommandOptions, CommandObjectThreadUntil::CommandOptions, CommandObjectThreadInfo::CommandOptions, CommandObjectThreadReturn::CommandOptions, CommandObjectThreadJump::CommandOptions, CommandObjectThreadPlanList::CommandOptions, CommandObjectTraceDumpFunctionCalls::CommandOptions, CommandObjectTraceDumpInstructions::CommandOptions, CommandObjectTraceDumpInfo::CommandOptions, CommandObjectTraceSave::CommandOptions, CommandObjectTraceLoad::CommandOptions, CommandObjectTraceDump::CommandOptions, CommandObjectTraceSchema::CommandOptions, CommandObjectTypeSummaryAdd::CommandOptions, CommandObjectTypeSynthAdd::CommandOptions, CommandObjectTypeFormatterDelete::CommandOptions, CommandObjectTypeFormatterClear::CommandOptions, CommandObjectTypeFormatterList< FormatterType >::CommandOptions, CommandObjectTypeCategoryDefine::CommandOptions, CommandObjectTypeCategoryEnable::CommandOptions, CommandObjectTypeCategoryDisable::CommandOptions, CommandObjectTypeFilterAdd::CommandOptions, CommandObjectWatchpointList::CommandOptions, CommandObjectWatchpointDelete::CommandOptions, CommandObjectWatchpointIgnore::CommandOptions, CommandObjectWatchpointModify::CommandOptions, CommandObjectWatchpointCommandAdd::CommandOptions, CommandObjectObjC_ClassTable_Dump::CommandOptions, sddarwinlog_private::EnableOptions, lldb_private::trace_intel_pt::CommandObjectThreadTraceStartIntelPT::CommandOptions, lldb_private::trace_intel_pt::CommandObjectProcessTraceStartIntelPT::CommandOptions, and lldb_private::ctf::CommandObjectThreadTraceExportCTF::CommandOptions.
Referenced by NotifyOptionParsingStarting().
void Options::OptionSeen | ( | int | short_option | ) |
Definition at line 79 of file Options.cpp.
References m_seen_options.
Referenced by Parse(), ParseAlias(), and ParseForCompletion().
|
protected |
Definition at line 103 of file Options.cpp.
Referenced by VerifyOptions().
|
protected |
Definition at line 123 of file Options.cpp.
Referenced by VerifyPartialOptions().
void Options::OutputFormattedUsageText | ( | Stream & | strm, |
const OptionDefinition & | option_def, | ||
uint32_t | output_max_columns | ||
) |
Definition at line 302 of file Options.cpp.
References lldb_private::Stream::EOL(), lldb_private::Stream::GetIndentLevel(), lldb_private::Stream::Indent(), lldb_private::OptionValidator::ShortConditionString(), lldb_private::OptionDefinition::usage_text, lldb_private::OptionDefinition::validator, and lldb_private::Stream::Write().
Referenced by GenerateOptionUsage().
llvm::Expected< Args > Options::Parse | ( | const Args & | args, |
ExecutionContext * | execution_context, | ||
lldb::PlatformSP | platform_sp, | ||
bool | require_validation | ||
) |
Parse the provided arguments.
The parsed options are set via calls to SetOptionValue. In case of a successful parse, the function returns a copy of the input arguments with the parsed options removed. Otherwise, it returns an error.
param[in] platform_sp The platform used for option validation. This is necessary because an empty execution_context is not enough to get us to a reasonable platform. If the platform isn't given, we'll try to get it from the execution context. If we can't get it from the execution context, we'll skip validation.
param[in] require_validation When true, it will fail option parsing if validation could not occur due to not having a platform.
Definition at line 1277 of file Options.cpp.
References BuildShortOptions(), lldb_private::Option::definition, lldb_private::OptionParser::eNoArgument, error(), lldb_private::Option::flag, lldb_private::Status::FromError(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormat(), lldb_private::Args::GetArgumentCount(), GetArgvForParsing(), GetLongOptions(), lldb_private::OptionParser::GetOptionArgument(), lldb_private::OptionParser::GetOptionIndex(), lldb_private::ExecutionContext::GetTargetSP(), lldb_private::OptionDefinition::long_option, lldb_private::OptionValidator::LongConditionString(), lldb_private::OptionDefinition::option_has_arg, OptionSeen(), lldb_private::OptionParser::Parse(), lldb_private::OptionParser::Prepare(), ReconstituteArgsAfterParsing(), SetOptionValue(), lldb_private::Option::val, lldb_private::OptionDefinition::validator, and lldb_private::validator.
Referenced by lldb_private::CommandObject::ParseOptions().
llvm::Expected< Args > Options::ParseAlias | ( | const Args & | args, |
OptionArgVector * | option_arg_vector, | ||
std::string & | input_line | ||
) |
Definition at line 962 of file Options.cpp.
References BuildShortOptions(), lldb_private::Option::definition, lldb_private::Args::DeleteArgumentAtIndex(), lldb_private::OptionParser::eNoArgument, lldb_private::OptionParser::eOptionalArgument, lldb_private::OptionParser::eRequiredArgument, FindArgumentIndexForOption(), lldb_private::Option::flag, lldb_private::CommandInterpreter::g_no_argument, lldb_private::Args::GetArgumentCount(), GetArgvForParsing(), GetLongOptions(), lldb_private::OptionParser::GetOptionArgument(), lldb_private::StreamString::GetString(), lldb_private::OptionDefinition::option_has_arg, OptionSeen(), lldb_private::OptionParser::Parse(), lldb_private::OptionParser::Prepare(), lldb_private::Stream::Printf(), and lldb_private::Option::val.
Referenced by ProcessAliasOptionsArgs().
OptionElementVector Options::ParseForCompletion | ( | const Args & | args, |
uint32_t | cursor_index | ||
) |
Definition at line 1099 of file Options.cpp.
References BuildShortOptions(), lldb_private::Option::definition, lldb_private::OptionArgElement::eBareDash, lldb_private::OptionArgElement::eBareDoubleDash, lldb_private::OptionParser::EnableError(), lldb_private::OptionParser::eNoArgument, lldb_private::OptionParser::eOptionalArgument, lldb_private::OptionParser::eRequiredArgument, lldb_private::OptionArgElement::eUnrecognizedArg, FindOriginalIndex(), lldb_private::Option::flag, GetArgvForParsing(), GetDefinitions(), GetLongOptions(), lldb_private::OptionParser::GetOptionArgument(), lldb_private::OptionParser::GetOptionErrorCause(), lldb_private::OptionParser::GetOptionIndex(), lldb_private::Args::ArgEntry::IsQuoted(), lldb_private::OptionDefinition::option_has_arg, OptionSeen(), lldb_private::OptionParser::Parse(), lldb_private::OptionParser::Prepare(), lldb_private::Args::ArgEntry::ref(), and lldb_private::Option::val.
Referenced by lldb_private::CommandObject::HandleCompletion().
|
pure virtual |
Set the value of an option.
[in] | option_idx | The index into the "struct option" array that was returned by Options::GetLongOptions(). |
[in] | option_arg | The argument value for the option that the user entered, or nullptr if there is no argument for the current option. |
[in] | execution_context | The execution context to use for evaluating the option. May be nullptr if the option is to be evaluated outside any particular context. |
Implemented in CommandObjectProcessContinue::CommandOptions, lldb_private::OptionGroupOptions, CommandObjectBreakpointList::CommandOptions, CommandObjectBreakpointClear::CommandOptions, CommandObjectBreakpointDelete::CommandOptions, CommandObjectBreakpointRead::CommandOptions, CommandObjectBreakpointWrite::CommandOptions, CommandObjectBreakpointCommandDelete::CommandOptions, CommandObjectCommandsSource::CommandOptions, CommandObjectCommandsAddRegex::CommandOptions, CommandObjectScriptingObjectParsed::CommandOptions, CommandObjectCommandsScriptImport::CommandOptions, CommandObjectCommandsScriptAdd::CommandOptions, CommandObjectCommandsContainerAdd::CommandOptions, CommandObjectDiagnosticsDump::CommandOptions, lldb_private::CommandObjectDisassemble::CommandOptions, CommandObjectFrameDiagnose::CommandOptions, CommandObjectFrameSelect::CommandOptions, CommandObjectFrameRecognizerAdd::CommandOptions, lldb_private::CommandObjectHelp::CommandOptions, CommandObjectLogEnable::CommandOptions, CommandObjectLogDump::CommandOptions, CommandObjectPlatformFRead::CommandOptions, CommandObjectPlatformFWrite::CommandOptions, CommandObjectPlatformProcessList::CommandOptions, CommandObjectPlatformShell::CommandOptions, CommandObjectProcessDetach::CommandOptions, CommandObjectProcessConnect::CommandOptions, CommandObjectProcessLoad::CommandOptions, CommandObjectProcessSaveCore::CommandOptions, CommandObjectProcessStatus::CommandOptions, CommandObjectProcessHandle::CommandOptions, CommandObjectScriptingRun::CommandOptions, CommandObjectScriptingExtensionList::CommandOptions, CommandObjectSessionHistory::CommandOptions, CommandObjectSettingsSet::CommandOptions, CommandObjectSettingsWrite::CommandOptions, CommandObjectSettingsRead::CommandOptions, CommandObjectSettingsClear::CommandOptions, CommandObjectSourceInfo::CommandOptions, CommandObjectSourceList::CommandOptions, CommandObjectStatsDump::CommandOptions, CommandObjectTargetModulesDumpSymtab::CommandOptions, CommandObjectTargetModulesDumpLineTable::CommandOptions, CommandObjectTargetModulesDumpSeparateDebugInfoFiles::CommandOptions, CommandObjectTargetModulesList::CommandOptions, CommandObjectTargetModulesShowUnwind::CommandOptions, CommandObjectTargetModulesLookup::CommandOptions, CommandObjectThreadBacktrace::CommandOptions, CommandObjectThreadUntil::CommandOptions, CommandObjectThreadInfo::CommandOptions, CommandObjectThreadReturn::CommandOptions, CommandObjectThreadJump::CommandOptions, CommandObjectThreadPlanList::CommandOptions, CommandObjectTraceDumpFunctionCalls::CommandOptions, CommandObjectTraceDumpInstructions::CommandOptions, CommandObjectTraceDumpInfo::CommandOptions, CommandObjectTraceSave::CommandOptions, CommandObjectTraceDump::CommandOptions, CommandObjectTraceSchema::CommandOptions, CommandObjectTypeSummaryAdd::CommandOptions, CommandObjectTypeSynthAdd::CommandOptions, CommandObjectTypeFormatterDelete::CommandOptions, CommandObjectTypeFormatterClear::CommandOptions, CommandObjectTypeFormatterList< FormatterType >::CommandOptions, CommandObjectTypeCategoryDefine::CommandOptions, CommandObjectTypeCategoryEnable::CommandOptions, CommandObjectTypeCategoryDisable::CommandOptions, CommandObjectTypeFilterAdd::CommandOptions, CommandObjectWatchpointList::CommandOptions, CommandObjectWatchpointDelete::CommandOptions, CommandObjectWatchpointIgnore::CommandOptions, CommandObjectWatchpointModify::CommandOptions, CommandObjectWatchpointCommandAdd::CommandOptions, CommandObjectObjC_ClassTable_Dump::CommandOptions, sddarwinlog_private::EnableOptions, lldb_private::trace_intel_pt::CommandObjectThreadTraceStartIntelPT::CommandOptions, lldb_private::trace_intel_pt::CommandObjectProcessTraceStartIntelPT::CommandOptions, and lldb_private::ctf::CommandObjectThreadTraceExportCTF::CommandOptions.
Referenced by Parse().
bool Options::SupportsLongOption | ( | const char * | long_option | ) |
Definition at line 362 of file Options.cpp.
References GetDefinitions().
Referenced by lldb_private::CommandInterpreter::ResolveCommandImpl().
bool Options::VerifyOptions | ( | CommandReturnObject & | result | ) |
Definition at line 141 of file Options.cpp.
References lldb_private::CommandReturnObject::AppendError(), lldb::eReturnStatusSuccessFinishNoResult, GetOptionalOptions(), GetRequiredOptions(), IsASubset(), m_seen_options, OptionsSetDiff(), and lldb_private::CommandReturnObject::SetStatus().
Referenced by lldb_private::CommandObject::ParseOptions().
bool Options::VerifyPartialOptions | ( | CommandReturnObject & | result | ) |
Definition at line 599 of file Options.cpp.
References GetOptionalOptions(), GetRequiredOptions(), IsASubset(), m_seen_options, and OptionsSetUnion().
Referenced by ProcessAliasOptionsArgs().
|
protected |
Definition at line 198 of file Options.h.
Referenced by CommandObjectWatchpointCommandAdd::DoExecute(), GetLongOptions(), CommandObjectProcessContinue::CommandOptions::SetOptionValue(), CommandObjectBreakpointList::CommandOptions::SetOptionValue(), CommandObjectBreakpointClear::CommandOptions::SetOptionValue(), CommandObjectBreakpointDelete::CommandOptions::SetOptionValue(), CommandObjectBreakpointRead::CommandOptions::SetOptionValue(), CommandObjectBreakpointWrite::CommandOptions::SetOptionValue(), CommandObjectBreakpointCommandDelete::CommandOptions::SetOptionValue(), CommandObjectCommandsSource::CommandOptions::SetOptionValue(), CommandObjectCommandsScriptImport::CommandOptions::SetOptionValue(), CommandObjectCommandsScriptAdd::CommandOptions::SetOptionValue(), CommandObjectCommandsContainerAdd::CommandOptions::SetOptionValue(), CommandObjectDiagnosticsDump::CommandOptions::SetOptionValue(), CommandObjectFrameDiagnose::CommandOptions::SetOptionValue(), CommandObjectFrameSelect::CommandOptions::SetOptionValue(), CommandObjectFrameRecognizerAdd::CommandOptions::SetOptionValue(), lldb_private::CommandObjectHelp::CommandOptions::SetOptionValue(), CommandObjectLogEnable::CommandOptions::SetOptionValue(), CommandObjectLogDump::CommandOptions::SetOptionValue(), CommandObjectPlatformFRead::CommandOptions::SetOptionValue(), CommandObjectPlatformFWrite::CommandOptions::SetOptionValue(), CommandObjectPlatformProcessList::CommandOptions::SetOptionValue(), CommandObjectProcessDetach::CommandOptions::SetOptionValue(), CommandObjectProcessConnect::CommandOptions::SetOptionValue(), CommandObjectProcessLoad::CommandOptions::SetOptionValue(), CommandObjectProcessSaveCore::CommandOptions::SetOptionValue(), CommandObjectProcessStatus::CommandOptions::SetOptionValue(), CommandObjectProcessHandle::CommandOptions::SetOptionValue(), CommandObjectScriptingRun::CommandOptions::SetOptionValue(), CommandObjectScriptingExtensionList::CommandOptions::SetOptionValue(), CommandObjectSessionHistory::CommandOptions::SetOptionValue(), CommandObjectSettingsWrite::CommandOptions::SetOptionValue(), CommandObjectSettingsRead::CommandOptions::SetOptionValue(), CommandObjectSettingsClear::CommandOptions::SetOptionValue(), CommandObjectStatsDump::CommandOptions::SetOptionValue(), CommandObjectTargetModulesDumpSymtab::CommandOptions::SetOptionValue(), CommandObjectTargetModulesDumpSeparateDebugInfoFiles::CommandOptions::SetOptionValue(), CommandObjectTargetModulesList::CommandOptions::SetOptionValue(), CommandObjectTargetModulesShowUnwind::CommandOptions::SetOptionValue(), CommandObjectTargetModulesLookup::CommandOptions::SetOptionValue(), CommandObjectThreadBacktrace::CommandOptions::SetOptionValue(), CommandObjectThreadUntil::CommandOptions::SetOptionValue(), CommandObjectThreadInfo::CommandOptions::SetOptionValue(), CommandObjectThreadReturn::CommandOptions::SetOptionValue(), CommandObjectThreadJump::CommandOptions::SetOptionValue(), CommandObjectThreadPlanList::CommandOptions::SetOptionValue(), CommandObjectTraceDumpFunctionCalls::CommandOptions::SetOptionValue(), CommandObjectTraceDumpInstructions::CommandOptions::SetOptionValue(), CommandObjectTraceDumpInfo::CommandOptions::SetOptionValue(), CommandObjectTraceSave::CommandOptions::SetOptionValue(), CommandObjectTraceDump::CommandOptions::SetOptionValue(), CommandObjectTraceSchema::CommandOptions::SetOptionValue(), CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue(), CommandObjectTypeSynthAdd::CommandOptions::SetOptionValue(), CommandObjectTypeFormatterDelete::CommandOptions::SetOptionValue(), CommandObjectTypeFormatterClear::CommandOptions::SetOptionValue(), CommandObjectTypeFormatterList< FormatterType >::CommandOptions::SetOptionValue(), sddarwinlog_private::EnableOptions::SetOptionValue(), lldb_private::trace_intel_pt::CommandObjectThreadTraceStartIntelPT::CommandOptions::SetOptionValue(), lldb_private::ctf::CommandObjectThreadTraceExportCTF::CommandOptions::SetOptionValue(), and CommandObjectTraceLoad::CommandOptions::SetOptionValue().
|
protected |
Definition at line 201 of file Options.h.
Referenced by BuildValidOptionSets(), and GetOptionalOptions().
|
protected |
Definition at line 200 of file Options.h.
Referenced by BuildValidOptionSets(), and GetRequiredOptions().
|
protected |
Definition at line 199 of file Options.h.
Referenced by NotifyOptionParsingStarting(), OptionSeen(), VerifyOptions(), and VerifyPartialOptions().