1 //===-- OperatingSystem.cpp -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Target/OperatingSystem.h"
11 #include "lldb/Core/PluginManager.h"
12 #include "lldb/Target/Thread.h"
15 using namespace lldb_private;
17 OperatingSystem *OperatingSystem::FindPlugin(Process *process,
18 const char *plugin_name) {
19 OperatingSystemCreateInstance create_callback = nullptr;
21 ConstString const_plugin_name(plugin_name);
23 PluginManager::GetOperatingSystemCreateCallbackForPluginName(
25 if (create_callback) {
26 std::unique_ptr<OperatingSystem> instance_ap(
27 create_callback(process, true));
29 return instance_ap.release();
32 for (uint32_t idx = 0;
34 PluginManager::GetOperatingSystemCreateCallbackAtIndex(idx)) !=
37 std::unique_ptr<OperatingSystem> instance_ap(
38 create_callback(process, false));
40 return instance_ap.release();
46 OperatingSystem::OperatingSystem(Process *process) : m_process(process) {}
48 OperatingSystem::~OperatingSystem() = default;
50 bool OperatingSystem::IsOperatingSystemPluginThread(
51 const lldb::ThreadSP &thread_sp) {
53 return thread_sp->IsOperatingSystemPluginThread();