1 //===-- OperatingSystem.cpp -----------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Target/OperatingSystem.h"
10 #include "lldb/Core/PluginManager.h"
11 #include "lldb/Target/Thread.h"
14 using namespace lldb_private
;
16 OperatingSystem
*OperatingSystem::FindPlugin(Process
*process
,
17 const char *plugin_name
) {
18 OperatingSystemCreateInstance create_callback
= nullptr;
21 PluginManager::GetOperatingSystemCreateCallbackForPluginName(
23 if (create_callback
) {
24 std::unique_ptr
<OperatingSystem
> instance_up(
25 create_callback(process
, true));
27 return instance_up
.release();
30 for (uint32_t idx
= 0;
32 PluginManager::GetOperatingSystemCreateCallbackAtIndex(idx
)) !=
35 std::unique_ptr
<OperatingSystem
> instance_up(
36 create_callback(process
, false));
38 return instance_up
.release();
44 OperatingSystem::OperatingSystem(Process
*process
) : m_process(process
) {}
46 bool OperatingSystem::IsOperatingSystemPluginThread(
47 const lldb::ThreadSP
&thread_sp
) {
49 return thread_sp
->IsOperatingSystemPluginThread();