summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/UserSettingsController.cpp
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2011-02-04 00:16:49 +0000
committerCaroline Tice <ctice@apple.com>2011-02-04 00:16:49 +0000
commit73fd2728b945c68371a8dd06dda19162fb58f2d4 (patch)
tree7c7c92f82fc2a3390f0ac01a4bef4f50f927d0b8 /lldb/source/Core/UserSettingsController.cpp
parent7cadb2f65be918d6012cea09da28196ef1641a2f (diff)
downloadbcm5719-llvm-73fd2728b945c68371a8dd06dda19162fb58f2d4.tar.gz
bcm5719-llvm-73fd2728b945c68371a8dd06dda19162fb58f2d4.zip
Modify 'apropos' command to search settings variable descriptions as well.
llvm-svn: 124836
Diffstat (limited to 'lldb/source/Core/UserSettingsController.cpp')
-rw-r--r--lldb/source/Core/UserSettingsController.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp
index ea7d84e9494..e6d7635807c 100644
--- a/lldb/source/Core/UserSettingsController.cpp
+++ b/lldb/source/Core/UserSettingsController.cpp
@@ -1353,6 +1353,75 @@ UserSettingsController::FindSettingsDescriptions (CommandInterpreter &interprete
}
void
+UserSettingsController::SearchAllSettingsDescriptions (CommandInterpreter &interpreter,
+ lldb::UserSettingsControllerSP root,
+ std::string &current_prefix,
+ const char *search_word,
+ StreamString &result_stream)
+{
+ if ((search_word == NULL) || (strlen (search_word) == 0))
+ return;
+
+ int num_entries = root->m_settings.global_settings.size();
+
+ if (num_entries > 0)
+ {
+ for (int i = 0; i < num_entries; ++i)
+ {
+ SettingEntry &entry = root->m_settings.global_settings[i];
+ if (strcasestr (entry.description, search_word) != NULL)
+ {
+ StreamString var_name;
+ if (current_prefix.size() > 0)
+ var_name.Printf ("%s.%s", current_prefix.c_str(), entry.var_name);
+ else
+ var_name.Printf ("%s", entry.var_name);
+ interpreter.OutputFormattedHelpText (result_stream, var_name.GetData(), "--", entry.description,
+ var_name.GetSize());
+ }
+ }
+ }
+
+ num_entries = root->m_settings.instance_settings.size();
+ if (num_entries > 0)
+ {
+ for (int i = 0; i < num_entries; ++i)
+ {
+ SettingEntry &entry = root->m_settings.instance_settings[i];
+ if (strcasestr (entry.description, search_word) != NULL)
+ {
+ StreamString var_name;
+ if (current_prefix.size() > 0)
+ var_name.Printf ("%s.%s", current_prefix.c_str(), entry.var_name);
+ else
+ var_name.Printf ("%s", entry.var_name);
+ interpreter.OutputFormattedHelpText (result_stream, var_name.GetData(), "--", entry.description,
+ var_name.GetSize());
+ }
+ }
+ }
+
+ int num_children = root->GetNumChildren ();
+ for (int i = 0; i < num_children; ++i)
+ {
+ lldb::UserSettingsControllerSP child = root->GetChildAtIndex (i);
+
+ if (child)
+ {
+ ConstString child_prefix = child->GetLevelName();
+ StreamString new_prefix;
+ if (! current_prefix.empty())
+ new_prefix.Printf ("%s.%s", current_prefix.c_str(), child_prefix.AsCString());
+ else
+ new_prefix.Printf ("%s", child_prefix.AsCString());
+ std::string new_prefix_str = new_prefix.GetData();
+ UserSettingsController::SearchAllSettingsDescriptions (interpreter, child, new_prefix_str, search_word,
+ result_stream);
+ }
+ }
+}
+
+void
UserSettingsController::GetAllVariableValues (CommandInterpreter &interpreter,
lldb::UserSettingsControllerSP root,
std::string &current_prefix,
OpenPOWER on IntegriCloud