[Lldb-commits] [PATCH] D106467: [LLDB][GUI] Add Process Plugin Field
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 21 14:38:54 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc93dc2597a58: [LLDB][GUI] Add Process Plugin Field (authored by OmarEmaraDev, committed by clayborg).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106467/new/
https://reviews.llvm.org/D106467
Files:
lldb/source/Core/IOHandlerCursesGUI.cpp
Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===================================================================
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -1504,6 +1504,29 @@
int m_first_visibile_choice;
};
+class ProcessPluginFieldDelegate : public ChoicesFieldDelegate {
+public:
+ ProcessPluginFieldDelegate()
+ : ChoicesFieldDelegate("Process Plugin", 3, GetPossiblePluginNames()) {}
+
+ std::vector<std::string> GetPossiblePluginNames() {
+ std::vector<std::string> names;
+ names.push_back("<default>");
+
+ size_t i = 0;
+ while (auto name = PluginManager::GetProcessPluginNameAtIndex(i++))
+ names.push_back(name);
+ return names;
+ }
+
+ std::string GetPluginName() {
+ std::string plugin_name = GetChoiceContent();
+ if (plugin_name == "<default>")
+ return "";
+ return plugin_name;
+ }
+};
+
template <class T> class ListFieldDelegate : public FieldDelegate {
public:
ListFieldDelegate(const char *label, T default_field)
@@ -1899,6 +1922,12 @@
return delegate;
}
+ ProcessPluginFieldDelegate *AddProcessPluginField() {
+ ProcessPluginFieldDelegate *delegate = new ProcessPluginFieldDelegate();
+ m_fields.push_back(FieldDelegateUP(delegate));
+ return delegate;
+ }
+
template <class T>
ListFieldDelegate<T> *AddListField(const char *label, T default_field) {
ListFieldDelegate<T> *delegate =
@@ -2347,8 +2376,7 @@
m_include_existing_field =
AddBooleanField("Include existing processes.", false);
m_show_advanced_field = AddBooleanField("Show advanced settings.", false);
- m_plugin_field =
- AddChoicesField("Plugin Name", 3, GetPossiblePluginNames());
+ m_plugin_field = AddProcessPluginField();
AddAction("Attach", [this](Window &window) { Attach(window); });
}
@@ -2390,16 +2418,6 @@
return module_sp->GetFileSpec().GetFilename().AsCString();
}
- std::vector<std::string> GetPossiblePluginNames() {
- std::vector<std::string> names;
- names.push_back("<default>");
-
- size_t i = 0;
- while (auto name = PluginManager::GetProcessPluginNameAtIndex(i++))
- names.push_back(name);
- return names;
- }
-
bool StopRunningProcess() {
ExecutionContext exe_ctx =
m_debugger.GetCommandInterpreter().GetExecutionContext();
@@ -2455,8 +2473,7 @@
} else {
attach_info.SetProcessID(m_pid_field->GetInteger());
}
- if (m_plugin_field->GetChoiceContent() != "<default>")
- attach_info.SetProcessPluginName(m_plugin_field->GetChoiceContent());
+ attach_info.SetProcessPluginName(m_plugin_field->GetPluginName());
return attach_info;
}
@@ -2504,7 +2521,7 @@
BooleanFieldDelegate *m_wait_for_field;
BooleanFieldDelegate *m_include_existing_field;
BooleanFieldDelegate *m_show_advanced_field;
- ChoicesFieldDelegate *m_plugin_field;
+ ProcessPluginFieldDelegate *m_plugin_field;
};
class MenuDelegate {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106467.360604.patch
Type: text/x-patch
Size: 2983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210721/91dc9a61/attachment.bin>
More information about the lldb-commits
mailing list