LLDBOptionValueParser#

class lldb.plugins.parsed_cmd.LLDBOptionValueParser#

This class holds the option definitions for the command, and when the command is run, you can ask the parser for the current values.

Attributes Summary

Methods Summary

add_argument_set(arguments)

add_option(short_option, long_option, help)

short_option: one character, must be unique, not required long_option: no spaces, must be unique, required help: a usage string for this option, will print in the command help default: the initial value for this option (if it has a value) dest: the name of the property that gives you access to the value for this value. Defaults to the long option if not provided. required: if true, this option must be provided or the command will error out groups: Which "option groups" does this option belong to. This can either be a simple list (e.g. [1, 3, 4, 5]) or you can specify ranges by sublists: so [1, [3,5]] is the same as [1, 3, 4, 5]. value_type: one of the lldb.eArgType enum values. Some of the common arg types also have default completers, which will be applied automatically. completion_type: currently these are values form the lldb.CompletionType enum. If you need custom completions, implement handle_option_argument_completion. enum_values: An array of duples: ["element_name", "element_help"]. If provided, only one of the enum elements is allowed. The value will be the element_name for the chosen enum element as a string.

dest_for_option(opt_name)

This will return the value of the dest variable you defined for opt_name.

determine_completion(arg_type)

get_option_element(long_name)

is_enum_opt(opt_name)

make_argument_element(arg_type[, repeat, groups])

option_parsing_started()

This makes the ivars for all the "dest" values in the array and gives them their default values.

set_enum_value(enum_values, input)

This sets the value for an enum option, you should not have to call this by hand.

set_option_value(exe_ctx, opt_name, opt_value)

This sets a single option value.

was_set(opt_name)

Call this in the __call__ method of your command to determine whether this option was set on the command line.

Attributes Documentation

completion_table = {<Mock name='mock.eArgTypeAddressOrExpression' id='135740549589440'>: <Mock name='mock.eVariablePathCompletion' id='135740549641664'>, <Mock name='mock.eArgTypeArchitecture' id='135740549589584'>: <Mock name='mock.eArchitectureCompletion' id='135740549641616'>, <Mock name='mock.eArgTypeBreakpointID' id='135740549589680'>: <Mock name='mock.eBreakpointCompletion' id='135740549641760'>, <Mock name='mock.eArgTypeBreakpointIDRange' id='135740549589728'>: <Mock name='mock.eBreakpointCompletion' id='135740549641760'>, <Mock name='mock.eArgTypeBreakpointName' id='135740549589776'>: <Mock name='mock.eBreakpointNameCompletion' id='135740549642144'>, <Mock name='mock.eArgTypeClassName' id='135740549589872'>: <Mock name='mock.eSymbolCompletion' id='135740549641424'>, <Mock name='mock.eArgTypeDirectoryName' id='135740549589200'>: <Mock name='mock.eDiskDirectoryCompletion' id='135740549641376'>, <Mock name='mock.eArgTypeExpression' id='135740549590160'>: <Mock name='mock.eVariablePathCompletion' id='135740549641664'>, <Mock name='mock.eArgTypeExpressionPath' id='135740549590208'>: <Mock name='mock.eVariablePathCompletion' id='135740549641664'>, <Mock name='mock.eArgTypeFilename' id='135740549590352'>: <Mock name='mock.eDiskFileCompletion' id='135740549641328'>, <Mock name='mock.eArgTypeFrameIndex' id='135740555127520'>: <Mock name='mock.eFrameIndexCompletion' id='135740549641952'>, <Mock name='mock.eArgTypeFunctionName' id='135740549590544'>: <Mock name='mock.eSymbolCompletion' id='135740549641424'>, <Mock name='mock.eArgTypeFunctionOrSymbol' id='135740549590592'>: <Mock name='mock.eSymbolCompletion' id='135740549641424'>, <Mock name='mock.eArgTypeLanguage' id='135740549590784'>: <Mock name='mock.eTypeLanguageCompletion' id='135740549641904'>, <Mock name='mock.eArgTypeModuleUUID' id='135740549592896'>: <Mock name='mock.eModuleUUIDCompletion' id='135740548969680'>, <Mock name='mock.eArgTypePath' id='135740555127424'>: <Mock name='mock.eDiskFileCompletion' id='135740549641328'>, <Mock name='mock.eArgTypePid' id='135740549591456'>: <Mock name='mock.eProcessIDCompletion' id='135740554507664'>, <Mock name='mock.eArgTypePlatform' id='135740554692896'>: <Mock name='mock.ePlatformPluginCompletion' id='135740549641568'>, <Mock name='mock.eArgTypeProcessName' id='135740549591552'>: <Mock name='mock.eProcessNameCompletion' id='135740549642000'>, <Mock name='mock.eArgTypeRegisterName' id='135740549591744'>: <Mock name='mock.eRegisterCompletion' id='135740549641712'>, <Mock name='mock.eArgTypeRunArgs' id='135740549591840'>: <Mock name='mock.eDiskFileCompletion' id='135740549641328'>, <Mock name='mock.eArgTypeShlibName' id='135740556530592'>: <Mock name='mock.eModuleCompletion' id='135740549641472'>, <Mock name='mock.eArgTypeSourceFile' id='135740549588480'>: <Mock name='mock.eSourceFileCompletion' id='135740549641280'>, <Mock name='mock.eArgTypeStopHookID' id='135740561398944'>: <Mock name='mock.eStopHookIDCompletion' id='135740549639840'>, <Mock name='mock.eArgTypeSymbol' id='135740549592272'>: <Mock name='mock.eSymbolCompletion' id='135740549641424'>, <Mock name='mock.eArgTypeThreadIndex' id='135740549592464'>: <Mock name='mock.eThreadIndexCompletion' id='135740549642048'>, <Mock name='mock.eArgTypeVarName' id='135740549592608'>: <Mock name='mock.eVariablePathCompletion' id='135740549641664'>, <Mock name='mock.eArgTypeWatchpointID' id='135740549592704'>: <Mock name='mock.eWatchpointIDCompletion' id='135740549642096'>, <Mock name='mock.eArgTypeWatchpointIDRange' id='135740549592752'>: <Mock name='mock.eWatchpointIDCompletion' id='135740549642096'>}#

Methods Documentation

add_argument_set(arguments)#
add_option(short_option, long_option, help, default=None, dest=None, required=False, groups=None, value_type=None, completion_type=None, enum_values=None)#

short_option: one character, must be unique, not required long_option: no spaces, must be unique, required help: a usage string for this option, will print in the command help default: the initial value for this option (if it has a value) dest: the name of the property that gives you access to the value for

this value. Defaults to the long option if not provided.

required: if true, this option must be provided or the command will error out groups: Which ā€œoption groupsā€ does this option belong to. This can either be

a simple list (e.g. [1, 3, 4, 5]) or you can specify ranges by sublists: so [1, [3,5]] is the same as [1, 3, 4, 5].

value_type: one of the lldb.eArgType enum values. Some of the common arg

types also have default completers, which will be applied automatically.

completion_type: currently these are values form the lldb.CompletionType enum. If

you need custom completions, implement handle_option_argument_completion.

enum_values: An array of duples: [ā€œelement_nameā€, ā€œelement_helpā€]. If provided,

only one of the enum elements is allowed. The value will be the element_name for the chosen enum element as a string.

dest_for_option(opt_name)#

This will return the value of the dest variable you defined for opt_name. Mostly useful for handle_completion where you get passed the long option.

classmethod determine_completion(arg_type)#
get_option_element(long_name)#
is_enum_opt(opt_name)#
make_argument_element(arg_type, repeat='optional', groups=None)#
option_parsing_started()#

This makes the ivars for all the ā€œdestā€ values in the array and gives them their default values. You should not have to call this by hand, though if you have some option that needs to do some work when a new command invocation starts, you can override this to handle your special option.

set_enum_value(enum_values, input)#

This sets the value for an enum option, you should not have to call this by hand.

set_option_value(exe_ctx, opt_name, opt_value)#

This sets a single option value. This will handle most option value types, but if you have an option that has some complex behavior, you can override this to implement that behavior, and then pass the rest of the options to the base class implementation.

was_set(opt_name)#

Call this in the __call__ method of your command to determine whether this option was set on the command line. It is sometimes useful to know whether an option has the default value because the user set it explicitly (was_set -> True) or not. You can also call this in a handle_completion method, but it will currently only report true values for the options mentioned BEFORE the cursor point in the command line.