diff options
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r-- | lldb/source/Interpreter/Args.cpp | 139 | ||||
-rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupArchitecture.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupBoolean.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupFile.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupFormat.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupOutputFile.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupPlatform.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupString.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupUInt64.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupUUID.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp | 22 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupVariable.cpp | 16 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionGroupWatchpoint.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Interpreter/Options.cpp | 16 |
16 files changed, 112 insertions, 134 deletions
diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp index 833afd606a1..ff94e0f6021 100644 --- a/lldb/source/Interpreter/Args.cpp +++ b/lldb/source/Interpreter/Args.cpp @@ -10,10 +10,6 @@ #include "lldb/lldb-python.h" // C Includes -#ifdef _WIN32 -#define _BSD_SOURCE // Required so that getopt.h defines optreset -#endif -#include <getopt.h> #include <cstdlib> // C++ Includes // Other libraries and framework includes @@ -624,7 +620,7 @@ Args::ParseOptions (Options &options) { StreamString sstr; Error error; - struct option *long_options = options.GetLongOptions(); + Option *long_options = options.GetLongOptions(); if (long_options == NULL) { error.SetErrorStringWithFormat("invalid long options"); @@ -641,24 +637,19 @@ Args::ParseOptions (Options &options) switch (long_options[i].has_arg) { default: - case no_argument: break; - case required_argument: sstr << ':'; break; - case optional_argument: sstr << "::"; break; + case OptionParser::eNoArgument: break; + case OptionParser::eRequiredArgument: sstr << ':'; break; + case OptionParser::eOptionalArgument: sstr << "::"; break; } } } } -#ifdef __GLIBC__ - optind = 0; -#else - optreset = 1; - optind = 1; -#endif + OptionParser::Prepare(); int val; while (1) { int long_options_index = -1; - val = ::getopt_long_only(GetArgumentCount(), + val = OptionParser::Parse(GetArgumentCount(), GetArgumentVector(), sstr.GetData(), long_options, @@ -696,7 +687,7 @@ Args::ParseOptions (Options &options) if (long_options_index >= 0) { error = options.SetOptionValue(long_options_index, - long_options[long_options_index].has_arg == no_argument ? NULL : optarg); + long_options[long_options_index].has_arg == OptionParser::eNoArgument ? NULL : OptionParser::GetOptionArgument()); } else { @@ -707,7 +698,7 @@ Args::ParseOptions (Options &options) } // Update our ARGV now that get options has consumed all the options - m_argv.erase(m_argv.begin(), m_argv.begin() + optind); + m_argv.erase(m_argv.begin(), m_argv.begin() + OptionParser::GetOptionIndex()); UpdateArgsAfterOptionParsing (); return error; } @@ -1226,7 +1217,7 @@ Args::LongestCommonPrefix (std::string &common_prefix) } size_t -Args::FindArgumentIndexForOption (struct option *long_options, int long_options_index) +Args::FindArgumentIndexForOption (Option *long_options, int long_options_index) { char short_buffer[3]; char long_buffer[255]; @@ -1278,7 +1269,7 @@ Args::ParseAliasOptions (Options &options, { StreamString sstr; int i; - struct option *long_options = options.GetLongOptions(); + Option *long_options = options.GetLongOptions(); if (long_options == NULL) { @@ -1295,29 +1286,24 @@ Args::ParseAliasOptions (Options &options, switch (long_options[i].has_arg) { default: - case no_argument: + case OptionParser::eNoArgument: break; - case required_argument: + case OptionParser::eRequiredArgument: sstr << ":"; break; - case optional_argument: + case OptionParser::eOptionalArgument: sstr << "::"; break; } } } -#ifdef __GLIBC__ - optind = 0; -#else - optreset = 1; - optind = 1; -#endif + OptionParser::Prepare(); int val; while (1) { int long_options_index = -1; - val = ::getopt_long_only (GetArgumentCount(), + val = OptionParser::Parse (GetArgumentCount(), GetArgumentVector(), sstr.GetData(), long_options, @@ -1361,17 +1347,17 @@ Args::ParseAliasOptions (Options &options, switch (long_options[long_options_index].has_arg) { - case no_argument: + case OptionParser::eNoArgument: option_arg_vector->push_back (OptionArgPair (std::string (option_str.GetData()), - OptionArgValue (no_argument, "<no-argument>"))); + OptionArgValue (OptionParser::eNoArgument, "<no-argument>"))); result.SetStatus (eReturnStatusSuccessFinishNoResult); break; - case required_argument: - if (optarg != NULL) + case OptionParser::eRequiredArgument: + if (OptionParser::GetOptionArgument() != NULL) { option_arg_vector->push_back (OptionArgPair (std::string (option_str.GetData()), - OptionArgValue (required_argument, - std::string (optarg)))); + OptionArgValue (OptionParser::eRequiredArgument, + std::string (OptionParser::GetOptionArgument())))); result.SetStatus (eReturnStatusSuccessFinishNoResult); } else @@ -1381,18 +1367,18 @@ Args::ParseAliasOptions (Options &options, result.SetStatus (eReturnStatusFailed); } break; - case optional_argument: - if (optarg != NULL) + case OptionParser::eOptionalArgument: + if (OptionParser::GetOptionArgument() != NULL) { option_arg_vector->push_back (OptionArgPair (std::string (option_str.GetData()), - OptionArgValue (optional_argument, - std::string (optarg)))); + OptionArgValue (OptionParser::eOptionalArgument, + std::string (OptionParser::GetOptionArgument())))); result.SetStatus (eReturnStatusSuccessFinishNoResult); } else { option_arg_vector->push_back (OptionArgPair (std::string (option_str.GetData()), - OptionArgValue (optional_argument, "<no-argument>"))); + OptionArgValue (OptionParser::eOptionalArgument, "<no-argument>"))); result.SetStatus (eReturnStatusSuccessFinishNoResult); } break; @@ -1424,10 +1410,10 @@ Args::ParseAliasOptions (Options &options, raw_input_string.erase (pos, strlen (tmp_arg)); } ReplaceArgumentAtIndex (idx, ""); - if ((long_options[long_options_index].has_arg != no_argument) - && (optarg != NULL) + if ((long_options[long_options_index].has_arg != OptionParser::eNoArgument) + && (OptionParser::GetOptionArgument() != NULL) && (idx+1 < GetArgumentCount()) - && (strcmp (optarg, GetArgumentAtIndex(idx+1)) == 0)) + && (strcmp (OptionParser::GetOptionArgument(), GetArgumentAtIndex(idx+1)) == 0)) { if (raw_input_string.size() > 0) { @@ -1455,7 +1441,7 @@ Args::ParseArgsForCompletion ) { StreamString sstr; - struct option *long_options = options.GetLongOptions(); + Option *long_options = options.GetLongOptions(); option_element_vector.clear(); if (long_options == NULL) @@ -1475,31 +1461,26 @@ Args::ParseArgsForCompletion switch (long_options[i].has_arg) { default: - case no_argument: + case OptionParser::eNoArgument: break; - case required_argument: + case OptionParser::eRequiredArgument: sstr << ":"; break; - case optional_argument: + case OptionParser::eOptionalArgument: sstr << "::"; break; } } } -#ifdef __GLIBC__ - optind = 0; -#else - optreset = 1; - optind = 1; -#endif - opterr = 0; + OptionParser::Prepare(); + OptionParser::EnableError(false); int val; const OptionDefinition *opt_defs = options.GetDefinitions(); - // Fooey... getopt_long_only permutes the GetArgumentVector to move the options to the front. - // So we have to build another Arg and pass that to getopt_long_only so it doesn't + // Fooey... OptionParser::Parse permutes the GetArgumentVector to move the options to the front. + // So we have to build another Arg and pass that to OptionParser::Parse so it doesn't // change the one we have. std::vector<const char *> dummy_vec (GetArgumentVector(), GetArgumentVector() + GetArgumentCount() + 1); @@ -1512,7 +1493,7 @@ Args::ParseArgsForCompletion bool missing_argument = false; int long_options_index = -1; - val = ::getopt_long_only (dummy_vec.size() - 1, + val = OptionParser::Parse (dummy_vec.size() - 1, (char *const *) &dummy_vec.front(), sstr.GetData(), long_options, @@ -1530,18 +1511,18 @@ Args::ParseArgsForCompletion // Handling the "--" is a little tricky, since that may mean end of options or arguments, or the // user might want to complete options by long name. I make this work by checking whether the // cursor is in the "--" argument, and if so I assume we're completing the long option, otherwise - // I let it pass to getopt_long_only which will terminate the option parsing. + // I let it pass to OptionParser::Parse which will terminate the option parsing. // Note, in either case we continue parsing the line so we can figure out what other options // were passed. This will be useful when we come to restricting completions based on what other // options we've seen on the line. - if (optind < dummy_vec.size() - 1 - && (strcmp (dummy_vec[optind-1], "--") == 0)) + if (OptionParser::GetOptionIndex() < dummy_vec.size() - 1 + && (strcmp (dummy_vec[OptionParser::GetOptionIndex()-1], "--") == 0)) { - dash_dash_pos = optind - 1; - if (optind - 1 == cursor_index) + dash_dash_pos = OptionParser::GetOptionIndex() - 1; + if (OptionParser::GetOptionIndex() - 1 == cursor_index) { - option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDoubleDash, optind - 1, + option_element_vector.push_back (OptionArgElement (OptionArgElement::eBareDoubleDash, OptionParser::GetOptionIndex() - 1, OptionArgElement::eBareDoubleDash)); continue; } @@ -1553,7 +1534,7 @@ Args::ParseArgsForCompletion } else if (val == '?') { - option_element_vector.push_back (OptionArgElement (OptionArgElement::eUnrecognizedArg, optind - 1, + option_element_vector.push_back (OptionArgElement (OptionArgElement::eUnrecognizedArg, OptionParser::GetOptionIndex() - 1, OptionArgElement::eUnrecognizedArg)); continue; } @@ -1564,7 +1545,7 @@ Args::ParseArgsForCompletion else if (val == ':') { // This is a missing argument. - val = optopt; + val = OptionParser::GetOptionErrorCause(); missing_argument = true; } @@ -1602,51 +1583,51 @@ Args::ParseArgsForCompletion switch (long_options[long_options_index].has_arg) { - case no_argument: - option_element_vector.push_back (OptionArgElement (opt_defs_index, optind - 1, 0)); + case OptionParser::eNoArgument: + option_element_vector.push_back (OptionArgElement (opt_defs_index, OptionParser::GetOptionIndex() - 1, 0)); break; - case required_argument: - if (optarg != NULL) + case OptionParser::eRequiredArgument: + if (OptionParser::GetOptionArgument() != NULL) { int arg_index; if (missing_argument) arg_index = -1; else - arg_index = optind - 1; + arg_index = OptionParser::GetOptionIndex() - 1; - option_element_vector.push_back (OptionArgElement (opt_defs_index, optind - 2, arg_index)); + option_element_vector.push_back (OptionArgElement (opt_defs_index, OptionParser::GetOptionIndex() - 2, arg_index)); } else { - option_element_vector.push_back (OptionArgElement (opt_defs_index, optind - 1, -1)); + option_element_vector.push_back (OptionArgElement (opt_defs_index, OptionParser::GetOptionIndex() - 1, -1)); } break; - case optional_argument: - if (optarg != NULL) + case OptionParser::eOptionalArgument: + if (OptionParser::GetOptionArgument() != NULL) { - option_element_vector.push_back (OptionArgElement (opt_defs_index, optind - 2, optind - 1)); + option_element_vector.push_back (OptionArgElement (opt_defs_index, OptionParser::GetOptionIndex() - 2, OptionParser::GetOptionIndex() - 1)); } else { - option_element_vector.push_back (OptionArgElement (opt_defs_index, optind - 2, optind - 1)); + option_element_vector.push_back (OptionArgElement (opt_defs_index, OptionParser::GetOptionIndex() - 2, OptionParser::GetOptionIndex() - 1)); } break; default: // The options table is messed up. Here we'll just continue - option_element_vector.push_back (OptionArgElement (OptionArgElement::eUnrecognizedArg, optind - 1, + option_element_vector.push_back (OptionArgElement (OptionArgElement::eUnrecognizedArg, OptionParser::GetOptionIndex() - 1, OptionArgElement::eUnrecognizedArg)); break; } } else { - option_element_vector.push_back (OptionArgElement (OptionArgElement::eUnrecognizedArg, optind - 1, + option_element_vector.push_back (OptionArgElement (OptionArgElement::eUnrecognizedArg, OptionParser::GetOptionIndex() - 1, OptionArgElement::eUnrecognizedArg)); } } // Finally we have to handle the case where the cursor index points at a single "-". We want to mark that in - // the option_element_vector, but only if it is not after the "--". But it turns out that getopt_long_only just ignores + // the option_element_vector, but only if it is not after the "--". But it turns out that OptionParser::Parse just ignores // an isolated "-". So we have to look it up by hand here. We only care if it is AT the cursor position. if ((dash_dash_pos == -1 || cursor_index < dash_dash_pos) diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 09b7dd9c2c9..053bb401b83 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -11,8 +11,6 @@ #include <string> #include <vector> - -#include <getopt.h> #include <stdlib.h> #include "CommandObjectScript.h" @@ -1326,9 +1324,9 @@ CommandInterpreter::BuildAliasResult (const char *alias_name, else { result_str.Printf (" %s", option.c_str()); - if (value_type != optional_argument) + if (value_type != OptionParser::eOptionalArgument) result_str.Printf (" "); - if (value.compare ("<no_argument>") != 0) + if (value.compare ("<OptionParser::eNoArgument>") != 0) { int index = GetOptionArgumentPosition (value.c_str()); if (index == 0) @@ -2295,7 +2293,7 @@ CommandInterpreter::BuildAliasCommandArgs (CommandObject *alias_cmd_obj, } else { - if (value_type != optional_argument) + if (value_type != OptionParser::eOptionalArgument) new_args.AppendArgument (option.c_str()); if (value.compare ("<no-argument>") != 0) { @@ -2303,7 +2301,7 @@ CommandInterpreter::BuildAliasCommandArgs (CommandObject *alias_cmd_obj, if (index == 0) { // value was NOT a positional argument; must be a real value - if (value_type != optional_argument) + if (value_type != OptionParser::eOptionalArgument) new_args.AppendArgument (value.c_str()); else { @@ -2330,7 +2328,7 @@ CommandInterpreter::BuildAliasCommandArgs (CommandObject *alias_cmd_obj, raw_input_string = raw_input_string.erase (strpos, strlen (cmd_args.GetArgumentAtIndex (index))); } - if (value_type != optional_argument) + if (value_type != OptionParser::eOptionalArgument) new_args.AppendArgument (cmd_args.GetArgumentAtIndex (index)); else { diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index fa5a9a0b2e8..6ab4af167b6 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -14,7 +14,6 @@ #include <string> #include <map> -#include <getopt.h> #include <stdlib.h> #include <ctype.h> diff --git a/lldb/source/Interpreter/OptionGroupArchitecture.cpp b/lldb/source/Interpreter/OptionGroupArchitecture.cpp index af103bb0bd9..d8f35675fba 100644 --- a/lldb/source/Interpreter/OptionGroupArchitecture.cpp +++ b/lldb/source/Interpreter/OptionGroupArchitecture.cpp @@ -30,7 +30,7 @@ OptionGroupArchitecture::~OptionGroupArchitecture () static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_1 , false, "arch" , 'a', required_argument, NULL, 0, eArgTypeArchitecture , "Specify the architecture for the target."}, + { LLDB_OPT_SET_1 , false, "arch" , 'a', OptionParser::eRequiredArgument, NULL, 0, eArgTypeArchitecture , "Specify the architecture for the target."}, }; uint32_t diff --git a/lldb/source/Interpreter/OptionGroupBoolean.cpp b/lldb/source/Interpreter/OptionGroupBoolean.cpp index 5b5b38478b0..feb135315e1 100644 --- a/lldb/source/Interpreter/OptionGroupBoolean.cpp +++ b/lldb/source/Interpreter/OptionGroupBoolean.cpp @@ -30,7 +30,7 @@ OptionGroupBoolean::OptionGroupBoolean (uint32_t usage_mask, m_option_definition.required = required; m_option_definition.long_option = long_option; m_option_definition.short_option = short_option; - m_option_definition.option_has_arg = no_argument_toggle_default ? no_argument : required_argument; + m_option_definition.option_has_arg = no_argument_toggle_default ? OptionParser::eNoArgument : OptionParser::eRequiredArgument; m_option_definition.enum_values = NULL; m_option_definition.completion_type = 0; m_option_definition.argument_type = eArgTypeBoolean; @@ -47,7 +47,7 @@ OptionGroupBoolean::SetOptionValue (CommandInterpreter &interpreter, const char *option_arg) { Error error; - if (m_option_definition.option_has_arg == no_argument) + if (m_option_definition.option_has_arg == OptionParser::eNoArgument) { // Not argument, toggle the default value and mark the option as having been set m_value.SetCurrentValue (!m_value.GetDefaultValue()); diff --git a/lldb/source/Interpreter/OptionGroupFile.cpp b/lldb/source/Interpreter/OptionGroupFile.cpp index 6867395789c..48469a80417 100644 --- a/lldb/source/Interpreter/OptionGroupFile.cpp +++ b/lldb/source/Interpreter/OptionGroupFile.cpp @@ -30,7 +30,7 @@ OptionGroupFile::OptionGroupFile (uint32_t usage_mask, m_option_definition.required = required; m_option_definition.long_option = long_option; m_option_definition.short_option = short_option; - m_option_definition.option_has_arg = required_argument; + m_option_definition.option_has_arg = OptionParser::eRequiredArgument; m_option_definition.enum_values = NULL; m_option_definition.completion_type = completion_type; m_option_definition.argument_type = argument_type; @@ -70,7 +70,7 @@ OptionGroupFileList::OptionGroupFileList (uint32_t usage_mask, m_option_definition.required = required; m_option_definition.long_option = long_option; m_option_definition.short_option = short_option; - m_option_definition.option_has_arg = required_argument; + m_option_definition.option_has_arg = OptionParser::eRequiredArgument; m_option_definition.enum_values = NULL; m_option_definition.completion_type = completion_type; m_option_definition.argument_type = argument_type; diff --git a/lldb/source/Interpreter/OptionGroupFormat.cpp b/lldb/source/Interpreter/OptionGroupFormat.cpp index 790cbb668fa..4e14248499f 100644 --- a/lldb/source/Interpreter/OptionGroupFormat.cpp +++ b/lldb/source/Interpreter/OptionGroupFormat.cpp @@ -42,10 +42,10 @@ OptionGroupFormat::~OptionGroupFormat () static OptionDefinition g_option_table[] = { -{ LLDB_OPT_SET_1, false, "format" ,'f', required_argument, NULL, 0, eArgTypeFormat , "Specify a format to be used for display."}, -{ LLDB_OPT_SET_2, false, "gdb-format",'G', required_argument, NULL, 0, eArgTypeGDBFormat, "Specify a format using a GDB format specifier string."}, -{ LLDB_OPT_SET_3, false, "size" ,'s', required_argument, NULL, 0, eArgTypeByteSize , "The size in bytes to use when displaying with the selected format."}, -{ LLDB_OPT_SET_4, false, "count" ,'c', required_argument, NULL, 0, eArgTypeCount , "The number of total items to display."}, +{ LLDB_OPT_SET_1, false, "format" ,'f', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFormat , "Specify a format to be used for display."}, +{ LLDB_OPT_SET_2, false, "gdb-format",'G', OptionParser::eRequiredArgument, NULL, 0, eArgTypeGDBFormat, "Specify a format using a GDB format specifier string."}, +{ LLDB_OPT_SET_3, false, "size" ,'s', OptionParser::eRequiredArgument, NULL, 0, eArgTypeByteSize , "The size in bytes to use when displaying with the selected format."}, +{ LLDB_OPT_SET_4, false, "count" ,'c', OptionParser::eRequiredArgument, NULL, 0, eArgTypeCount , "The number of total items to display."}, }; uint32_t diff --git a/lldb/source/Interpreter/OptionGroupOutputFile.cpp b/lldb/source/Interpreter/OptionGroupOutputFile.cpp index aa01bf54964..3bb8ab3b29c 100644 --- a/lldb/source/Interpreter/OptionGroupOutputFile.cpp +++ b/lldb/source/Interpreter/OptionGroupOutputFile.cpp @@ -31,8 +31,8 @@ OptionGroupOutputFile::~OptionGroupOutputFile () static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_1 , false, "outfile", 'o', required_argument, NULL, 0, eArgTypeFilename , "Specify a path for capturing command output."}, - { LLDB_OPT_SET_1 , false, "append-outfile" , 'apnd', no_argument, NULL, 0, eArgTypeNone , "Append to the the file specified with '--outfile <path>'."}, + { LLDB_OPT_SET_1 , false, "outfile", 'o', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFilename , "Specify a path for capturing command output."}, + { LLDB_OPT_SET_1 , false, "append-outfile" , 'apnd', OptionParser::eNoArgument, NULL, 0, eArgTypeNone , "Append to the the file specified with '--outfile <path>'."}, }; uint32_t diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp index a54edafd019..83e28bdd02c 100644 --- a/lldb/source/Interpreter/OptionGroupPlatform.cpp +++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp @@ -85,10 +85,10 @@ OptionGroupPlatform::OptionParsingStarting (CommandInterpreter &interpreter) static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_ALL, false, "platform", 'p', required_argument, NULL, 0, eArgTypePlatform, "Specify name of the platform to use for this target, creating the platform if necessary."}, - { LLDB_OPT_SET_ALL, false, "version" , 'v', required_argument, NULL, 0, eArgTypeNone, "Specify the initial SDK version to use prior to connecting." }, - { LLDB_OPT_SET_ALL, false, "build" , 'b', required_argument, NULL, 0, eArgTypeNone, "Specify the initial SDK build number." }, - { LLDB_OPT_SET_ALL, false, "sysroot" , 'S', required_argument, NULL, 0, eArgTypeFilename, "Specify the SDK root directory that contains a root of all remote system files." } + { LLDB_OPT_SET_ALL, false, "platform", 'p', OptionParser::eRequiredArgument, NULL, 0, eArgTypePlatform, "Specify name of the platform to use for this target, creating the platform if necessary."}, + { LLDB_OPT_SET_ALL, false, "version" , 'v', OptionParser::eRequiredArgument, NULL, 0, eArgTypeNone, "Specify the initial SDK version to use prior to connecting." }, + { LLDB_OPT_SET_ALL, false, "build" , 'b', OptionParser::eRequiredArgument, NULL, 0, eArgTypeNone, "Specify the initial SDK build number." }, + { LLDB_OPT_SET_ALL, false, "sysroot" , 'S', OptionParser::eRequiredArgument, NULL, 0, eArgTypeFilename, "Specify the SDK root directory that contains a root of all remote system files." } }; const OptionDefinition* diff --git a/lldb/source/Interpreter/OptionGroupString.cpp b/lldb/source/Interpreter/OptionGroupString.cpp index ee9623967c6..37a70d0bb24 100644 --- a/lldb/source/Interpreter/OptionGroupString.cpp +++ b/lldb/source/Interpreter/OptionGroupString.cpp @@ -31,7 +31,7 @@ OptionGroupString::OptionGroupString (uint32_t usage_mask, m_option_definition.required = required; m_option_definition.long_option = long_option; m_option_definition.short_option = short_option; - m_option_definition.option_has_arg = required_argument; + m_option_definition.option_has_arg = OptionParser::eRequiredArgument; m_option_definition.enum_values = NULL; m_option_definition.completion_type = completion_type; m_option_definition.argument_type = argument_type; diff --git a/lldb/source/Interpreter/OptionGroupUInt64.cpp b/lldb/source/Interpreter/OptionGroupUInt64.cpp index e6996f70255..b66c8457923 100644 --- a/lldb/source/Interpreter/OptionGroupUInt64.cpp +++ b/lldb/source/Interpreter/OptionGroupUInt64.cpp @@ -31,7 +31,7 @@ OptionGroupUInt64::OptionGroupUInt64 (uint32_t usage_mask, m_option_definition.required = required; m_option_definition.long_option = long_option; m_option_definition.short_option = short_option; - m_option_definition.option_has_arg = required_argument; + m_option_definition.option_has_arg = OptionParser::eRequiredArgument; m_option_definition.enum_values = NULL; m_option_definition.completion_type = completion_type; m_option_definition.argument_type = argument_type; diff --git a/lldb/source/Interpreter/OptionGroupUUID.cpp b/lldb/source/Interpreter/OptionGroupUUID.cpp index 14bdc8494e4..fb3ebcf7745 100644 --- a/lldb/source/Interpreter/OptionGroupUUID.cpp +++ b/lldb/source/Interpreter/OptionGroupUUID.cpp @@ -30,7 +30,7 @@ OptionGroupUUID::~OptionGroupUUID () static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_1 , false, "uuid", 'u', required_argument, NULL, 0, eArgTypeNone, "A module UUID value."}, + { LLDB_OPT_SET_1 , false, "uuid", 'u', OptionParser::eRequiredArgument, NULL, 0, eArgTypeNone, "A module UUID value."}, }; uint32_t diff --git a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp index 22a7f37740d..0129d3ed3f8 100644 --- a/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp +++ b/lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp @@ -33,17 +33,17 @@ OptionGroupValueObjectDisplay::~OptionGroupValueObjectDisplay () static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_1, false, "dynamic-type", 'd', required_argument, g_dynamic_value_types, 0, eArgTypeNone, "Show the object as its full dynamic type, not its static type, if available."}, - { LLDB_OPT_SET_1, false, "synthetic-type", 'S', required_argument, NULL, 0, eArgTypeBoolean, "Show the object obeying its synthetic provider, if available."}, - { LLDB_OPT_SET_1, false, "depth", 'D', required_argument, NULL, 0, eArgTypeCount, "Set the max recurse depth when dumping aggregate types (default is infinity)."}, - { LLDB_OPT_SET_1, false, "flat", 'F', no_argument, NULL, 0, eArgTypeNone, "Display results in a flat format that uses expression paths for each variable or member."}, - { LLDB_OPT_SET_1, false, "location", 'L', no_argument, NULL, 0, eArgTypeNone, "Show variable location information."}, - { LLDB_OPT_SET_1, false, "object-description", 'O', no_argument, NULL, 0, eArgTypeNone, "Print as an Objective-C object."}, - { LLDB_OPT_SET_1, false, "ptr-depth", 'P', required_argument, NULL, 0, eArgTypeCount, "The number of pointers to be traversed when dumping values (default is zero)."}, - { LLDB_OPT_SET_1, false, "show-types", 'T', no_argument, NULL, 0, eArgTypeNone, "Show variable types when dumping values."}, - { LLDB_OPT_SET_1, false, "no-summary-depth", 'Y', optional_argument, NULL, 0, eArgTypeCount, "Set the depth at which omitting summary information stops (default is 1)."}, - { LLDB_OPT_SET_1, false, "raw-output", 'R', no_argument, NULL, 0, eArgTypeNone, "Don't use formatting options."}, - { LLDB_OPT_SET_1, false, "show-all-children", 'A', no_argument, NULL, 0, eArgTypeNone, "Ignore the upper bound on the number of children to show."}, + { LLDB_OPT_SET_1, false, "dynamic-type", 'd', OptionParser::eRequiredArgument, g_dynamic_value_types, 0, eArgTypeNone, "Show the object as its full dynamic type, not its static type, if available."}, + { LLDB_OPT_SET_1, false, "synthetic-type", 'S', OptionParser::eRequiredArgument, NULL, 0, eArgTypeBoolean, "Show the object obeying its synthetic provider, if available."}, + { LLDB_OPT_SET_1, false, "depth", 'D', OptionParser::eRequiredArgument, NULL, 0, eArgTypeCount, "Set the max recurse depth when dumping aggregate types (default is infinity)."}, + { LLDB_OPT_SET_1, false, "flat", 'F', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Display results in a flat format that uses expression paths for each variable or member."}, + { LLDB_OPT_SET_1, false, "location", 'L', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Show variable location information."}, + { LLDB_OPT_SET_1, false, "object-description", 'O', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Print as an Objective-C object."}, + { LLDB_OPT_SET_1, false, "ptr-depth", 'P', OptionParser::eRequiredArgument, NULL, 0, eArgTypeCount, "The number of pointers to be traversed when dumping values (default is zero)."}, + { LLDB_OPT_SET_1, false, "show-types", 'T', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Show variable types when dumping values."}, + { LLDB_OPT_SET_1, false, "no-summary-depth", 'Y', OptionParser::eOptionalArgument, NULL, 0, eArgTypeCount, "Set the depth at which omitting summary information stops (default is 1)."}, + { LLDB_OPT_SET_1, false, "raw-output", 'R', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Don't use formatting options."}, + { LLDB_OPT_SET_1, false, "show-all-children", 'A', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Ignore the upper bound on the number of children to show."}, { 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL } }; diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp index 316747eff03..31c2547e2c3 100644 --- a/lldb/source/Interpreter/OptionGroupVariable.cpp +++ b/lldb/source/Interpreter/OptionGroupVariable.cpp @@ -28,14 +28,14 @@ using namespace lldb_private; static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-args", 'a', no_argument, NULL, 0, eArgTypeNone, "Omit function arguments."}, - { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-locals", 'l', no_argument, NULL, 0, eArgTypeNone, "Omit local variables."}, - { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-globals", 'g', no_argument, NULL, 0, eArgTypeNone, "Show the current frame source file global and static variables."}, - { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-declaration",'c', no_argument, NULL, 0, eArgTypeNone, "Show variable declaration information (source file and line where the variable was declared)."}, - { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "regex", 'r', no_argument, NULL, 0, eArgTypeRegularExpression, "The <variable-name> argument for name lookups are regular expressions."}, - { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "scope", 's', no_argument, NULL, 0, eArgTypeNone, "Show variable scope (argument, local, global, static)."}, - { LLDB_OPT_SET_1, false, "summary", 'y', required_argument, NULL, 0, eArgTypeName, "Specify the summary that the variable output should use."}, - { LLDB_OPT_SET_2, false, "summary-string", 'z', required_argument, NULL, 0, eArgTypeName, "Specify a summary string to use to format the variable output."}, + { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-args", 'a', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Omit function arguments."}, + { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-locals", 'l', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Omit local variables."}, + { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-globals", 'g', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Show the current frame source file global and static variables."}, + { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-declaration",'c', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Show variable declaration information (source file and line where the variable was declared)."}, + { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "regex", 'r', OptionParser::eNoArgument, NULL, 0, eArgTypeRegularExpression, "The <variable-name> argument for name lookups are regular expressions."}, + { LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "scope", 's', OptionParser::eNoArgument, NULL, 0, eArgTypeNone, "Show variable scope (argument, local, global, static)."}, + { LLDB_OPT_SET_1, false, "summary", 'y', OptionParser::eRequiredArgument, NULL, 0, eArgTypeName, "Specify the summary that the variable output should use."}, + { LLDB_OPT_SET_2, false, "summary-string", 'z', OptionParser::eRequiredArgument, NULL, 0, eArgTypeName, "Specify a summary string to use to format the variable output."}, }; static Error diff --git a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp index 9eef37a3ae6..09dc8ed88d2 100644 --- a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp +++ b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp @@ -40,8 +40,8 @@ static OptionEnumValueElement g_watch_size[] = static OptionDefinition g_option_table[] = { - { LLDB_OPT_SET_1, false, "watch", 'w', required_argument, g_watch_type, 0, eArgTypeWatchType, "Specify the type of watching to perform."}, - { LLDB_OPT_SET_1, false, "xsize", 'x', required_argument, g_watch_size, 0, eArgTypeByteSize, "Number of bytes to use to watch a region."} + { LLDB_OPT_SET_1, false, "watch", 'w', OptionParser::eRequiredArgument, g_watch_type, 0, eArgTypeWatchType, "Specify the type of watching to perform."}, + { LLDB_OPT_SET_1, false, "xsize", 'x', OptionParser::eRequiredArgument, g_watch_size, 0, eArgTypeByteSize, "Number of bytes to use to watch a region."} }; diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index af700ea9a95..8d245cc15da 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -256,7 +256,7 @@ Options::NumCommandOptions () return i; } -struct option * +Option * Options::GetLongOptions () { // Check to see if this has already been done. @@ -444,13 +444,13 @@ PrintOption (const OptionDefinition &opt_def, strm.Printf ("--%s", opt_def.long_option); switch (opt_def.option_has_arg) { - case no_argument: + case OptionParser::eNoArgument: break; - case required_argument: + case OptionParser::eRequiredArgument: strm.Printf (" <%s>", CommandObject::GetArgumentName (opt_def.argument_type)); break; - case optional_argument: + case OptionParser::eOptionalArgument: strm.Printf ("%s[<%s>]", show_short_option ? "" : "=", CommandObject::GetArgumentName (opt_def.argument_type)); @@ -529,7 +529,7 @@ Options::GenerateOptionUsage // Add current option to the end of out_stream. if (opt_defs[i].required == true && - opt_defs[i].option_has_arg == no_argument) + opt_defs[i].option_has_arg == OptionParser::eNoArgument) { options.insert (opt_defs[i].short_option); } @@ -560,7 +560,7 @@ Options::GenerateOptionUsage // Add current option to the end of out_stream. if (opt_defs[i].required == false && - opt_defs[i].option_has_arg == no_argument) + opt_defs[i].option_has_arg == OptionParser::eNoArgument) { options.insert (opt_defs[i].short_option); } @@ -591,7 +591,7 @@ Options::GenerateOptionUsage { if (opt_defs[i].usage_mask & opt_set_mask && isprint8(opt_defs[i].short_option)) { - if (opt_defs[i].required && opt_defs[i].option_has_arg != no_argument) + if (opt_defs[i].required && opt_defs[i].option_has_arg != OptionParser::eNoArgument) PrintOption (opt_defs[i], eDisplayBestOption, " ", NULL, true, strm); } } @@ -604,7 +604,7 @@ Options::GenerateOptionUsage { // Add current option to the end of out_stream. - if (!opt_defs[i].required && opt_defs[i].option_has_arg != no_argument) + if (!opt_defs[i].required && opt_defs[i].option_has_arg != OptionParser::eNoArgument) PrintOption (opt_defs[i], eDisplayBestOption, " ", NULL, true, strm); } } |