blob: c58362dec03aaa35efd8a32b9e056a760cdc3cdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
//===-- OperatingSystemPlugin.h ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "lldb/Core/PluginManager.h"
#include "lldb/Target/OperatingSystem.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadList.h"
/// An operating system plugin that does nothing: simply keeps the thread lists
/// as they are.
class OperatingSystemIdentityMap : public lldb_private::OperatingSystem {
public:
OperatingSystemIdentityMap(lldb_private::Process *process)
: OperatingSystem(process) {}
static OperatingSystem *CreateInstance(lldb_private::Process *process,
bool force) {
return new OperatingSystemIdentityMap(process);
}
static llvm::StringRef GetPluginNameStatic() { return "identity map"; }
static llvm::StringRef GetPluginDescriptionStatic() { return ""; }
static void Initialize() {
lldb_private::PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance, nullptr);
}
static void Terminate() {
lldb_private::PluginManager::UnregisterPlugin(CreateInstance);
}
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
// Simply adds the threads from real_thread_list into new_thread_list.
bool UpdateThreadList(lldb_private::ThreadList &old_thread_list,
lldb_private::ThreadList &real_thread_list,
lldb_private::ThreadList &new_thread_list) override {
for (const auto &real_thread : real_thread_list.Threads())
new_thread_list.AddThread(real_thread);
return true;
}
void ThreadWasSelected(lldb_private::Thread *thread) override {}
lldb::RegisterContextSP
CreateRegisterContextForThread(lldb_private::Thread *thread,
lldb::addr_t reg_data_addr) override {
return thread->GetRegisterContext();
}
lldb::StopInfoSP
CreateThreadStopReason(lldb_private::Thread *thread) override {
return thread->GetStopInfo();
}
};
|