1 //===-- OperatingSystem.cpp --------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 11 #include "lldb/Target/OperatingSystem.h" 12 // C Includes 13 // C++ Includes 14 // Other libraries and framework includes 15 #include "lldb/Core/PluginManager.h" 16 17 18 using namespace lldb; 19 using namespace lldb_private; 20 21 22 OperatingSystem* 23 OperatingSystem::FindPlugin (Process *process, const char *plugin_name) 24 { 25 OperatingSystemCreateInstance create_callback = NULL; 26 if (plugin_name) 27 { 28 create_callback = PluginManager::GetOperatingSystemCreateCallbackForPluginName (plugin_name); 29 if (create_callback) 30 { 31 STD_UNIQUE_PTR(OperatingSystem) instance_ap(create_callback(process, true)); 32 if (instance_ap.get()) 33 return instance_ap.release(); 34 } 35 } 36 else 37 { 38 for (uint32_t idx = 0; (create_callback = PluginManager::GetOperatingSystemCreateCallbackAtIndex(idx)) != NULL; ++idx) 39 { 40 STD_UNIQUE_PTR(OperatingSystem) instance_ap(create_callback(process, false)); 41 if (instance_ap.get()) 42 return instance_ap.release(); 43 } 44 } 45 return NULL; 46 } 47 48 49 OperatingSystem::OperatingSystem (Process *process) : 50 m_process (process) 51 { 52 } 53 54 OperatingSystem::~OperatingSystem() 55 { 56 } 57