summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/UserSettingsController.h7
-rw-r--r--lldb/source/Commands/CommandObjectApropos.cpp15
-rw-r--r--lldb/source/Core/UserSettingsController.cpp69
3 files changed, 91 insertions, 0 deletions
diff --git a/lldb/include/lldb/Core/UserSettingsController.h b/lldb/include/lldb/Core/UserSettingsController.h
index af73cb17630..3c071b1057f 100644
--- a/lldb/include/lldb/Core/UserSettingsController.h
+++ b/lldb/include/lldb/Core/UserSettingsController.h
@@ -147,6 +147,13 @@ public:
const char *search_name,
StreamString &result_stream,
Error &err);
+
+ static void
+ SearchAllSettingsDescriptions (CommandInterpreter &interpreter,
+ lldb::UserSettingsControllerSP root,
+ std::string &current_prefix,
+ const char *search_word,
+ StreamString &result_stream);
static void
GetAllVariableValues (CommandInterpreter &interpreter,
diff --git a/lldb/source/Commands/CommandObjectApropos.cpp b/lldb/source/Commands/CommandObjectApropos.cpp
index 1bab2c97d9b..1d003fc888e 100644
--- a/lldb/source/Commands/CommandObjectApropos.cpp
+++ b/lldb/source/Commands/CommandObjectApropos.cpp
@@ -95,6 +95,21 @@ CommandObjectApropos::Execute
max_len);
}
+
+
+ StreamString settings_search_results;
+ lldb::UserSettingsControllerSP root = Debugger::GetSettingsController ();
+ std::string settings_prefix = root->GetLevelName().AsCString();
+
+ UserSettingsController::SearchAllSettingsDescriptions (m_interpreter, root, settings_prefix, search_word,
+ settings_search_results);
+
+ if (settings_search_results.GetSize() > 0)
+ {
+ result.AppendMessageWithFormat ("\nThe following settings variables may relate to '%s': \n\n", search_word);
+ result.AppendMessageWithFormat ("%s", settings_search_results.GetData());
+ }
+
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
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