summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Platform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target/Platform.cpp')
-rw-r--r--lldb/source/Target/Platform.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index dddccad07bf..bc365603774 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -95,6 +95,37 @@ Platform::LocateExecutableScriptingResources (Target *target, Module &module)
return FileSpecList();
}
+Platform*
+Platform::FindPlugin (Process *process, const char *plugin_name)
+{
+ PlatformCreateInstance create_callback = NULL;
+ if (plugin_name)
+ {
+ create_callback = PluginManager::GetPlatformCreateCallbackForPluginName (plugin_name);
+ if (create_callback)
+ {
+ ArchSpec arch;
+ if (process)
+ {
+ arch = process->GetTarget().GetArchitecture();
+ }
+ std::auto_ptr<Platform> instance_ap(create_callback(process, &arch));
+ if (instance_ap.get())
+ return instance_ap.release();
+ }
+ }
+ else
+ {
+ for (uint32_t idx = 0; (create_callback = PluginManager::GetPlatformCreateCallbackAtIndex(idx)) != NULL; ++idx)
+ {
+ std::auto_ptr<Platform> instance_ap(create_callback(process, false));
+ if (instance_ap.get())
+ return instance_ap.release();
+ }
+ }
+ return NULL;
+}
+
Error
Platform::GetSharedModule (const ModuleSpec &module_spec,
ModuleSP &module_sp,
OpenPOWER on IntegriCloud