aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectSettings.cpp
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2010-09-15 06:56:39 +0000
committerCaroline Tice <ctice@apple.com>2010-09-15 06:56:39 +0000
commit7d9edf670b518e80af18a39366a316f1288280f5 (patch)
treef3c2f98e7cf90dc34c4b622349b066d10703b18e /lldb/source/Commands/CommandObjectSettings.cpp
parent6dbd39838d785028d521e7916ae938e905340fff (diff)
downloadllvm-7d9edf670b518e80af18a39366a316f1288280f5.zip
llvm-7d9edf670b518e80af18a39366a316f1288280f5.tar.gz
llvm-7d9edf670b518e80af18a39366a316f1288280f5.tar.bz2
Modify "settings list" so you can specify a particular instance setting name,
or a settings prefix, and it will list information about the subset of settings you requested. Also added tab-completion (now that it takes an optional argument). llvm-svn: 113952
Diffstat (limited to 'lldb/source/Commands/CommandObjectSettings.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectSettings.cpp52
1 files changed, 46 insertions, 6 deletions
diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp
index b0db637..8e6a5b1 100644
--- a/lldb/source/Commands/CommandObjectSettings.cpp
+++ b/lldb/source/Commands/CommandObjectSettings.cpp
@@ -367,8 +367,8 @@ CommandObjectSettingsShow::HandleArgumentCompletion (CommandInterpreter &interpr
CommandObjectSettingsList::CommandObjectSettingsList () :
CommandObject ("settings list",
- "List all the internal debugger settings variables that are available to the user to 'set' or 'show'.",
- "settings list")
+ "List and describe all the internal debugger settings variables that are available to the user to 'set' or 'show', or describe a particular variable or set of variables (by specifying the variable name or a common prefix).",
+ "settings list [<setting-name> | <setting-name-prefix>]")
{
}
@@ -379,16 +379,31 @@ CommandObjectSettingsList::~CommandObjectSettingsList()
bool
CommandObjectSettingsList::Execute (CommandInterpreter &interpreter,
- Args& command,
- CommandReturnObject &result)
+ Args& command,
+ CommandReturnObject &result)
{
UserSettingsControllerSP root_settings = Debugger::GetSettingsController ();
std::string current_prefix = root_settings->GetLevelName().AsCString();
Error err;
- UserSettingsController::FindAllSettingsDescriptions (interpreter, root_settings, current_prefix,
- result.GetOutputStream(), err);
+ if (command.GetArgumentCount() == 0)
+ {
+ UserSettingsController::FindAllSettingsDescriptions (interpreter, root_settings, current_prefix,
+ result.GetOutputStream(), err);
+ }
+ else if (command.GetArgumentCount() == 1)
+ {
+ const char *search_name = command.GetArgumentAtIndex (0);
+ UserSettingsController::FindSettingsDescriptions (interpreter, root_settings, current_prefix,
+ search_name, result.GetOutputStream(), err);
+ }
+ else
+ {
+ result.AppendError ("Too many aguments for 'settings list' command.\n");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
if (err.Fail ())
{
@@ -403,6 +418,31 @@ CommandObjectSettingsList::Execute (CommandInterpreter &interpreter,
return result.Succeeded();
}
+int
+CommandObjectSettingsList::HandleArgumentCompletion (CommandInterpreter &interpreter,
+ Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ OptionElementVector &opt_element_vector,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+{
+ std::string completion_str (input.GetArgumentAtIndex (cursor_index));
+ completion_str.erase (cursor_char_position);
+
+ CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
+ CommandCompletions::eSettingsNameCompletion,
+ completion_str.c_str(),
+ match_start_point,
+ max_return_elements,
+ NULL,
+ word_complete,
+ matches);
+ return matches.GetSize();
+}
+
//-------------------------------------------------------------------------
// CommandObjectSettingsRemove
//-------------------------------------------------------------------------