General command line help cleanup:

- All single character options will now be printed together
- Changed all options that contains underscores to contain '-' instead
- Made the help come out a little flatter by showing the long and short
  option on the same line.
- Modified the short character for "--ignore-count" options to "-i"

llvm-svn: 114265
This commit is contained in:
Greg Clayton 2010-09-18 03:37:20 +00:00
parent a6ba082cb6
commit ed8a705cea
17 changed files with 128 additions and 77 deletions

View File

@ -269,7 +269,7 @@ public:
/// @param[in] add_inline_child_block_variables
/// If this is \b false, no child variables of child blocks
/// that are inlined functions will be gotten. If \b true then
/// all child variables will be added regardless of wether they
/// all child variables will be added regardless of whether they
/// come from inlined functions or not.
///
/// @return

View File

@ -270,7 +270,7 @@ public:
GetUUID (UUID* uuid) = 0;
//------------------------------------------------------------------
/// Gets wether endian swapping should occur when extracting data
/// Gets whether endian swapping should occur when extracting data
/// from this object file.
///
/// @return

View File

@ -92,7 +92,7 @@ public:
DidLaunch () = 0;
//------------------------------------------------------------------
/// Get wether the process should stop when images change.
/// Get whether the process should stop when images change.
///
/// When images (executables and shared libraries) get loaded or
/// unloaded, often debug sessions will want to try and resolve or
@ -108,7 +108,7 @@ public:
GetStopWhenImagesChange () const;
//------------------------------------------------------------------
/// Set wether the process should stop when images change.
/// Set whether the process should stop when images change.
///
/// When images (executables and shared libraries) get loaded or
/// unloaded, often debug sessions will want to try and resolve or
@ -117,7 +117,7 @@ public:
/// can be overridden using this function callback.
///
/// @param[in] stop
/// Boolean value that indicates wether the process should stop
/// Boolean value that indicates whether the process should stop
/// when images change.
//------------------------------------------------------------------
void

View File

@ -436,7 +436,7 @@ public:
//------------------------------------------------------------------
/// Check if a plug-in instance can debug the file in \a module.
///
/// Each plug-in is given a chance to say wether it can debug
/// Each plug-in is given a chance to say whether it can debug
/// the file in \a module. If the Process plug-in instance can
/// debug a file on the current system, it should return \b true.
///

View File

@ -74,19 +74,19 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_ALL, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "<shlib-name>",
"Set the breakpoint only in this shared library (can use this option multiple times for multiple shlibs)."},
{ LLDB_OPT_SET_ALL, false, "ignore_count", 'k', required_argument, NULL, 0, "<n>",
{ LLDB_OPT_SET_ALL, false, "ignore-count", 'i', required_argument, NULL, 0, "<n>",
"Set the number of times this breakpoint is sKipped before stopping." },
{ LLDB_OPT_SET_ALL, false, "thread_index", 'x', required_argument, NULL, NULL, "<thread_index>",
"The breakpoint stops only for the thread whose indeX matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread-index", 'x', required_argument, NULL, NULL, "<thread-index>",
"The breakpoint stops only for the thread whose index matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread_id", 't', required_argument, NULL, NULL, "<thread_id>",
{ LLDB_OPT_SET_ALL, false, "thread-id", 't', required_argument, NULL, NULL, "<thread-id>",
"The breakpoint stops only for the thread whose TID matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread_name", 'T', required_argument, NULL, NULL, "<thread_name>",
{ LLDB_OPT_SET_ALL, false, "thread-name", 'T', required_argument, NULL, NULL, "<thread-name>",
"The breakpoint stops only for the thread whose thread name matches this argument."},
{ LLDB_OPT_SET_ALL, false, "queue_name", 'q', required_argument, NULL, NULL, "<queue_name>",
{ LLDB_OPT_SET_ALL, false, "queue-name", 'q', required_argument, NULL, NULL, "<queue-name>",
"The breakpoint stops only for threads in the queue whose name is given by this argument."},
{ LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "<filename>",
@ -116,7 +116,7 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_6, true, "method", 'M', required_argument, NULL, 0, "<method>",
"Set the breakpoint by C++ method names." },
{ LLDB_OPT_SET_7, true, "func_regex", 'r', required_argument, NULL, 0, "<regular-expression>",
{ LLDB_OPT_SET_7, true, "func-regex", 'r', required_argument, NULL, 0, "<regex>",
"Set the breakpoint by function name, evaluating a regular-expression to find the function name(s)." },
{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL }
@ -186,7 +186,7 @@ CommandObjectBreakpointSet::CommandOptions::SetOptionValue (int option_idx, cons
m_modules.push_back (std::string (option_arg));
break;
}
case 'k':
case 'i':
{
m_ignore_count = Args::StringToUInt32(optarg, UINT32_MAX, 0);
if (m_ignore_count == UINT32_MAX)
@ -1098,29 +1098,14 @@ CommandObjectBreakpointModify::CommandOptions::~CommandOptions ()
lldb::OptionDefinition
CommandObjectBreakpointModify::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_ALL, false, "ignore_count", 'k', required_argument, NULL, 0, NULL,
"Set the number of times this breakpoint is sKipped before stopping." },
{ LLDB_OPT_SET_ALL, false, "thread_index", 'x', required_argument, NULL, NULL, "<thread_index>",
"The breakpoint stops only for the thread whose indeX matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread_id", 't', required_argument, NULL, NULL, "<thread_id>",
"The breakpoint stops only for the thread whose TID matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread_name", 'T', required_argument, NULL, NULL, "<thread_name>",
"The breakpoint stops only for the thread whose thread name matches this argument."},
{ LLDB_OPT_SET_ALL, false, "queue_name", 'q', required_argument, NULL, NULL, "<queue_name>",
"The breakpoint stops only for threads in the queue whose name is given by this argument."},
{ LLDB_OPT_SET_1, false, "enable", 'e', no_argument, NULL, NULL, NULL,
"Enable the breakpoint."},
{ LLDB_OPT_SET_2, false, "disable", 'd', no_argument, NULL, NULL, NULL,
"Disable the breakpoint."},
{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL }
{ LLDB_OPT_SET_ALL, false, "ignore-count", 'i', required_argument, NULL, NULL, "<n>", "Set the number of times this breakpoint is skipped before stopping." },
{ LLDB_OPT_SET_ALL, false, "thread-index", 'x', required_argument, NULL, NULL, "<thread-index>", "The breakpoint stops only for the thread whose indeX matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread-id", 't', required_argument, NULL, NULL, "<thread-id>", "The breakpoint stops only for the thread whose TID matches this argument."},
{ LLDB_OPT_SET_ALL, false, "thread-name", 'T', required_argument, NULL, NULL, "<thread-name>", "The breakpoint stops only for the thread whose thread name matches this argument."},
{ LLDB_OPT_SET_ALL, false, "queue-name", 'q', required_argument, NULL, NULL, "<queue-name>", "The breakpoint stops only for threads in the queue whose name is given by this argument."},
{ LLDB_OPT_SET_1, false, "enable", 'e', no_argument, NULL, NULL, NULL, "Enable the breakpoint."},
{ LLDB_OPT_SET_2, false, "disable", 'd', no_argument, NULL, NULL, NULL, "Disable the breakpoint."},
{ 0, false, NULL, 0 , 0, NULL, 0, NULL, NULL }
};
const lldb::OptionDefinition*
@ -1145,7 +1130,7 @@ CommandObjectBreakpointModify::CommandOptions::SetOptionValue (int option_idx, c
m_enable_passed = true;
m_enable_value = true;
break;
case 'k':
case 'i':
{
m_ignore_count = Args::StringToUInt32(optarg, UINT32_MAX, 0);
if (m_ignore_count == UINT32_MAX)

View File

@ -48,7 +48,7 @@ CommandObjectBreakpointCommandAdd::CommandOptions::~CommandOptions ()
lldb::OptionDefinition
CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_ALL, false, "one_liner", 'o', required_argument, NULL, 0, "<one-liner>",
{ LLDB_OPT_SET_ALL, false, "one-liner", 'o', required_argument, NULL, 0, "<one-liner>",
"Specify a one-liner inline." },
{ LLDB_OPT_SET_1, true, "script", 's', no_argument, NULL, 0, NULL,

View File

@ -302,7 +302,7 @@ CommandObjectCall::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."},
{ LLDB_OPT_SET_1, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."},
{ LLDB_OPT_SET_1, false, "noexecute", 'n', no_argument, NULL, 0, "no execute", "Only JIT and copy the wrapper & arguments, but don't execute."},
{ LLDB_OPT_SET_1, false, "useabi", 'a', no_argument, NULL, 0, NULL, "Use the ABI instead of the JIT to marshall arguments."},
{ LLDB_OPT_SET_1, false, "use-abi", 'a', no_argument, NULL, 0, NULL, "Use the ABI instead of the JIT to marshall arguments."},
{ 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL }
};

View File

@ -290,7 +290,12 @@ public:
CommandObjectFrameVariable (CommandInterpreter &interpreter) :
CommandObject (interpreter,
"frame variable",
"Show specified argument, local variable, static variable or global variable for the current frame. If none specified, list them all.",
"Show frame variables. All argument and local variables "
"that are in scope will be shown when no arguments are given. "
"If any arguments are specified, they can be names of "
"argument, local, file static and file global variables."
"Children of aggregate variables can be specified such as "
"'var->child.x'.",
"frame variable [<cmd-options>] [<var-name1> [<var-name2>...]]")
{
}
@ -766,7 +771,7 @@ CommandObjectFrameVariable::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_1, false, "debug", 'D', no_argument, NULL, 0, NULL, "Enable verbose debug information."},
{ LLDB_OPT_SET_1, false, "depth", 'd', required_argument, NULL, 0, "<count>", "Set the max recurse depth when dumping aggregate types (default is infinity)."},
{ LLDB_OPT_SET_1, false, "show-globals",'g', no_argument, NULL, 0, NULL, "Show the current frame source file global and static variables."},
{ LLDB_OPT_SET_1, false, "find-global",'G', required_argument, NULL, 0, NULL, "Find a global variable by name (which might not be in the current stack frame source file)."},
{ LLDB_OPT_SET_1, false, "find-global",'G', required_argument, NULL, 0, "<name>", "Find a global variable by name (which might not be in the current stack frame source file)."},
{ LLDB_OPT_SET_1, false, "location", 'L', no_argument, NULL, 0, NULL, "Show variable location information."},
{ LLDB_OPT_SET_1, false, "show-declaration", 'c', no_argument, NULL, 0, NULL, "Show variable declaration information (source file and line where the variable was declared)."},
{ LLDB_OPT_SET_1, false, "name", 'n', required_argument, NULL, 0, "<name>", "Lookup a variable by name or regex (--regex) for the current execution context."},

View File

@ -646,7 +646,7 @@ CommandObjectProcessAttach::CommandOptions::g_option_table[] =
{ LLDB_OPT_SET_ALL, false, "plugin", 'P', required_argument, NULL, 0, "<plugin>", "Name of the process plugin you want to use."},
{ LLDB_OPT_SET_1, false, "pid", 'p', required_argument, NULL, 0, "<pid>", "The process ID of an existing process to attach to."},
{ LLDB_OPT_SET_2, false, "name", 'n', required_argument, NULL, 0, "<process-name>", "The name of the process to attach to."},
{ LLDB_OPT_SET_2, false, "waitfor", 'w', no_argument, NULL, 0, NULL, "Wait for the the process with <process-name> to launch."},
{ LLDB_OPT_SET_2, false, "waitfor",'w', no_argument, NULL, 0, NULL, "Wait for the the process with <process-name> to launch."},
{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL }
};

View File

@ -207,7 +207,6 @@ lldb::OptionDefinition
CommandObjectSettingsSet::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "override", 'o', no_argument, NULL, NULL, NULL, "Causes already existing instances and pending settings to use this new value. This option only makes sense when setting default values." },
{ LLDB_OPT_SET_2, false, "reset", 'r', no_argument, NULL, NULL, NULL, "Causes value to be reset to the original default for this variable. No value needs to be specified when this option is used." },
};

View File

@ -559,8 +559,7 @@ lldb::OptionDefinition
CommandObjectSourceList::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_ALL, false, "count", 'c', required_argument, NULL, 0, "<count>", "The number of source lines to display."},
{ LLDB_OPT_SET_ALL, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "<shlib-name>",
"Look up the source file in the given shared library."},
{ LLDB_OPT_SET_ALL, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "<shlib-name>", "Look up the source file in the given shared library."},
{ LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "<file>", "The file from which to display source."},
{ LLDB_OPT_SET_1, false, "line", 'l', required_argument, NULL, 0, "<line>", "The line number at which to start the display source."},
{ LLDB_OPT_SET_2, false, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, "<symbol>", "The name of a function whose source to display."},

View File

@ -755,26 +755,26 @@ protected:
static lldb::OptionEnumValueElement
g_tri_running_mode[] =
{
{ eOnlyThisThread, "thisThread", "Run only this thread"},
{ eAllThreads, "allThreads", "Run all threads"},
{ eOnlyDuringStepping, "whileStepping", "Run only this thread while stepping"},
{ eOnlyThisThread, "this-thread", "Run only this thread"},
{ eAllThreads, "all-threads", "Run all threads"},
{ eOnlyDuringStepping, "while-stepping", "Run only this thread while stepping"},
{ 0, NULL, NULL }
};
static lldb::OptionEnumValueElement
g_duo_running_mode[] =
{
{ eOnlyThisThread, "thisThread", "Run only this thread"},
{ eAllThreads, "allThreads", "Run all threads"},
{ eOnlyThisThread, "this-thread", "Run only this thread"},
{ eAllThreads, "all-threads", "Run all threads"},
{ 0, NULL, NULL }
};
lldb::OptionDefinition
CommandObjectThreadStepWithTypeAndScope::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "avoid_no_debug", 'a', required_argument, NULL, 0, "<avoid_no_debug>", "Should step-in step over functions with no debug information"},
{ LLDB_OPT_SET_1, false, "run_mode", 'm', required_argument, g_tri_running_mode, 0, "<run_mode>", "Determine how to run other threads while stepping this one"},
{ LLDB_OPT_SET_1, false, "regexp_to_avoid",'r', required_argument, NULL, 0, "<avoid_regexp>", "Should step-in step over functions matching this regexp"},
{ LLDB_OPT_SET_1, false, "avoid-no-debug", 'a', required_argument, NULL, 0, "<bool>", "A boolean value that sets whether step-in will step over functions with no debug information."},
{ LLDB_OPT_SET_1, false, "run-mode", 'm', required_argument, g_tri_running_mode, 0, "<run-mode>","Determine how to run other threads while stepping the current thread."},
{ LLDB_OPT_SET_1, false, "step-over-regexp",'r', required_argument, NULL, 0, "<regexp>", "A regular expression that defines function names to step over."},
{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL }
};
@ -1217,7 +1217,7 @@ CommandObjectThreadUntil::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "frame", 'f', required_argument, NULL, 0, "<frame>", "Frame index for until operation - defaults to 0"},
{ LLDB_OPT_SET_1, false, "thread", 't', required_argument, NULL, 0, "<thread>", "Thread index for the thread for until operation"},
{ LLDB_OPT_SET_1, false, "run_mode",'m', required_argument, g_duo_running_mode, 0, "<run_mode>","Determine how to run other threads while stepping this one"},
{ LLDB_OPT_SET_1, false, "run-mode",'m', required_argument, g_duo_running_mode, 0, "<run_mode>","Determine how to run other threads while stepping this one"},
{ 0, false, NULL, 0, 0, NULL, 0, NULL, NULL }
};

View File

@ -262,7 +262,7 @@ DataExtractor::GetByteOrder () const
return m_byte_order;
}
//------------------------------------------------------------------
// Set wether this object will endian swap values as it extracts
// Set whether this object will endian swap values as it extracts
// data.
//------------------------------------------------------------------
void

View File

@ -58,7 +58,7 @@ DynamicLoader::~DynamicLoader()
}
//----------------------------------------------------------------------
// Accessosors to the global setting as to wether to stop at image
// Accessosors to the global setting as to whether to stop at image
// (shared library) loading/unloading.
//----------------------------------------------------------------------
bool

View File

@ -111,7 +111,7 @@ ValueObject::UpdateValueIfNeeded (ExecutionContextScope *exe_scope)
UpdateValue (exe_scope);
// Update the fact that we tried to update the value for this
// value object wether or not we succeed
// value object whether or not we succeed
m_update_id = stop_id;
bool success = m_error.Success();
SetValueIsValid (success);

View File

@ -402,6 +402,76 @@ Options::GenerateOptionUsage
strm.Printf ("\n");
strm.Indent (name);
// First go through and print all options that take no arguments as
// a single string. If a command has "-a" "-b" and "-c", this will show
// up as [-abc]
std::set<char> options;
std::set<char>::const_iterator options_pos, options_end;
bool first;
for (i = 0, first = true; i < num_options; ++i)
{
if (full_options_table[i].usage_mask & opt_set_mask)
{
// Add current option to the end of out_stream.
if (full_options_table[i].required == true &&
full_options_table[i].option_has_arg == no_argument)
{
options.insert (full_options_table[i].short_option);
}
}
}
if (options.empty() == false)
{
// We have some required options with no arguments
strm.PutCString(" -");
for (i=0; i<2; ++i)
for (options_pos = options.begin(), options_end = options.end();
options_pos != options_end;
++options_pos)
{
if (i==0 && ::isupper (*options_pos))
continue;
if (i==1 && ::islower (*options_pos))
continue;
strm << *options_pos;
}
}
for (i = 0, options.clear(); i < num_options; ++i)
{
if (full_options_table[i].usage_mask & opt_set_mask)
{
// Add current option to the end of out_stream.
if (full_options_table[i].required == false &&
full_options_table[i].option_has_arg == no_argument)
{
options.insert (full_options_table[i].short_option);
}
}
}
if (options.empty() == false)
{
// We have some required options with no arguments
strm.PutCString(" [-");
for (i=0; i<2; ++i)
for (options_pos = options.begin(), options_end = options.end();
options_pos != options_end;
++options_pos)
{
if (i==0 && ::isupper (*options_pos))
continue;
if (i==1 && ::islower (*options_pos))
continue;
strm << *options_pos;
}
strm.PutChar(']');
}
// First go through and print the required options (list them up front).
for (i = 0; i < num_options; ++i)
@ -424,8 +494,6 @@ Options::GenerateOptionUsage
full_options_table[i].short_option,
full_options_table[i].argument_name);
}
else
strm.Printf (" -%c", full_options_table[i].short_option);
}
}
}
@ -446,8 +514,6 @@ Options::GenerateOptionUsage
else if (full_options_table[i].option_has_arg == optional_argument)
strm.Printf (" [-%c [%s]]", full_options_table[i].short_option,
full_options_table[i].argument_name);
else
strm.Printf (" [-%c]", full_options_table[i].short_option);
}
}
}
@ -455,8 +521,7 @@ Options::GenerateOptionUsage
strm.Printf ("\n\n");
// Now print out all the detailed information about the various options: long form, short form and help text:
// -- long_name <argument>
// - short <argument>
// --long_name <argument> ( -short <argument> )
// help text
// This variable is used to keep track of which options' info we've printed out, because some options can be in
@ -507,15 +572,13 @@ Options::GenerateOptionUsage
strm.EOL();
strm.Indent ();
strm.Printf ("-%c ", full_options_table[i].short_option);
strm.Printf ("--%s", full_options_table[i].long_option);
if (full_options_table[i].argument_name != NULL)
strm.PutCString(full_options_table[i].argument_name);
strm.EOL();
strm.Indent ();
strm.Printf ("--%s ", full_options_table[i].long_option);
strm.Printf (" %s", full_options_table[i].argument_name);
strm.Printf (" ( -%c", full_options_table[i].short_option);
if (full_options_table[i].argument_name != NULL)
strm.PutCString(full_options_table[i].argument_name);
strm.EOL();
strm.Printf (" %s", full_options_table[i].argument_name);
strm.PutCString(" )\n");
strm.IndentMore (5);

View File

@ -891,7 +891,7 @@ typedef struct DumpInfo
// entry is successfully parsed.
//
// This function dump DWARF information and obey recurse depth and
// wether a single DIE is to be dumped (or all of the data).
// whether a single DIE is to be dumped (or all of the data).
//----------------------------------------------------------------------
static dw_offset_t DumpCallback
(