LLDB mainline
OperatingSystem.cpp
Go to the documentation of this file.
1//===-- OperatingSystem.cpp -----------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
11#include "lldb/Target/Thread.h"
12
13using namespace lldb;
14using namespace lldb_private;
15
17 const char *plugin_name) {
18 OperatingSystemCreateInstance create_callback = nullptr;
19 if (plugin_name) {
20 create_callback =
22 plugin_name);
23 if (create_callback) {
24 std::unique_ptr<OperatingSystem> instance_up(
25 create_callback(process, true));
26 if (instance_up)
27 return instance_up.release();
28 }
29 } else {
30 for (auto create_callback :
32 std::unique_ptr<OperatingSystem> instance_up(
33 create_callback(process, false));
34 if (instance_up)
35 return instance_up.release();
36 }
37 }
38 return nullptr;
39}
40
42
44 const lldb::ThreadSP &thread_sp) {
45 if (thread_sp)
46 return thread_sp->IsOperatingSystemPluginThread();
47 return false;
48}
static OperatingSystem * FindPlugin(Process *process, const char *plugin_name)
Find a halted OS plugin for a given process.
Process * m_process
The process that this dynamic loader plug-in is tracking.
virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp)
static llvm::SmallVector< OperatingSystemCreateInstance > GetOperatingSystemCreateCallbacks()
static OperatingSystemCreateInstance GetOperatingSystemCreateCallbackForPluginName(llvm::StringRef name)
A plug-in interface definition class for debugging a process.
Definition Process.h:354
A class that represents a running process on the host machine.
OperatingSystem *(* OperatingSystemCreateInstance)(Process *process, bool force)
std::shared_ptr< lldb_private::Thread > ThreadSP