#include "lldb/Core/PluginManager.h"
#include "lldb/Target/OperatingSystem.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadList.h"
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(); }
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();
}
};