summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/PluginManager.cpp
diff options
context:
space:
mode:
authorRyan Brown <ribrdb@google.com>2015-09-16 21:20:44 +0000
committerRyan Brown <ribrdb@google.com>2015-09-16 21:20:44 +0000
commit65d4d5c3c6d742855f572d1306af93fabe015b0a (patch)
treef6a840baed06cdc87a15c0610b45fcad359fbe10 /lldb/source/Core/PluginManager.cpp
parent8be1847b09e358cacfb6219e8b0cdeaf77f1b9fe (diff)
downloadbcm5719-llvm-65d4d5c3c6d742855f572d1306af93fabe015b0a.tar.gz
bcm5719-llvm-65d4d5c3c6d742855f572d1306af93fabe015b0a.zip
Add an OperatingSystem plugin to support goroutines
The Go runtime schedules user level threads (goroutines) across real threads. This adds an OS plugin to create memory threads for goroutines. It supports the 1.4 and 1.5 go runtime. Differential Revision: http://reviews.llvm.org/D5871 llvm-svn: 247852
Diffstat (limited to 'lldb/source/Core/PluginManager.cpp')
-rw-r--r--lldb/source/Core/PluginManager.cpp62
1 files changed, 55 insertions, 7 deletions
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index 2770bbb258a..4c0d2e772f0 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -771,16 +771,18 @@ PluginManager::GetEmulateInstructionCreateCallbackForPluginName (const ConstStri
struct OperatingSystemInstance
{
- OperatingSystemInstance() :
- name(),
- description(),
- create_callback(NULL)
+ OperatingSystemInstance () :
+ name (),
+ description (),
+ create_callback (nullptr),
+ debugger_init_callback (nullptr)
{
}
ConstString name;
std::string description;
OperatingSystemCreateInstance create_callback;
+ DebuggerInitializeCallback debugger_init_callback;
};
typedef std::vector<OperatingSystemInstance> OperatingSystemInstances;
@@ -800,9 +802,9 @@ GetOperatingSystemInstances ()
}
bool
-PluginManager::RegisterPlugin (const ConstString &name,
- const char *description,
- OperatingSystemCreateInstance create_callback)
+PluginManager::RegisterPlugin(const ConstString &name, const char *description,
+ OperatingSystemCreateInstance create_callback,
+ DebuggerInitializeCallback debugger_init_callback)
{
if (create_callback)
{
@@ -812,6 +814,7 @@ PluginManager::RegisterPlugin (const ConstString &name,
if (description && description[0])
instance.description = description;
instance.create_callback = create_callback;
+ instance.debugger_init_callback = debugger_init_callback;
Mutex::Locker locker (GetOperatingSystemMutex ());
GetOperatingSystemInstances ().push_back (instance);
}
@@ -2579,6 +2582,16 @@ PluginManager::DebuggerInitialize (Debugger &debugger)
sym_file.debugger_init_callback (debugger);
}
}
+
+ // Initialize the OperatingSystem plugins
+ {
+ Mutex::Locker locker(GetOperatingSystemMutex());
+ for (auto &os : GetOperatingSystemInstances())
+ {
+ if (os.debugger_init_callback)
+ os.debugger_init_callback(debugger);
+ }
+ }
}
// This is the preferred new way to register plugin specific settings. e.g.
@@ -2823,3 +2836,38 @@ PluginManager::CreateSettingForJITLoaderPlugin (Debugger &debugger,
description,
is_global_property);
}
+
+static const char *kOperatingSystemPluginName("os");
+
+lldb::OptionValuePropertiesSP
+PluginManager::GetSettingForOperatingSystemPlugin(Debugger &debugger, const ConstString &setting_name)
+{
+ lldb::OptionValuePropertiesSP properties_sp;
+ lldb::OptionValuePropertiesSP plugin_type_properties_sp(
+ GetDebuggerPropertyForPlugins(debugger, ConstString(kOperatingSystemPluginName),
+ ConstString(), // not creating to so we don't need the description
+ false));
+ if (plugin_type_properties_sp)
+ properties_sp = plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
+ return properties_sp;
+}
+
+bool
+PluginManager::CreateSettingForOperatingSystemPlugin(Debugger &debugger,
+ const lldb::OptionValuePropertiesSP &properties_sp,
+ const ConstString &description, bool is_global_property)
+{
+ if (properties_sp)
+ {
+ lldb::OptionValuePropertiesSP plugin_type_properties_sp(
+ GetDebuggerPropertyForPlugins(debugger, ConstString(kOperatingSystemPluginName),
+ ConstString("Settings for operating system plug-ins"), true));
+ if (plugin_type_properties_sp)
+ {
+ plugin_type_properties_sp->AppendProperty(properties_sp->GetName(), description, is_global_property,
+ properties_sp);
+ return true;
+ }
+ }
+ return false;
+}
OpenPOWER on IntegriCloud