diff options
author | 2020-08-03 14:33:06 +0000 | |
---|---|---|
committer | 2020-08-03 14:33:06 +0000 | |
commit | 061da546b983eb767bad15e67af1174fb0bcf31c (patch) | |
tree | 83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp | |
parent | Import LLVM 10.0.0 release including clang, lld and lldb. (diff) | |
download | wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip |
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom
tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp')
-rw-r--r-- | gnu/llvm/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp b/gnu/llvm/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp new file mode 100644 index 00000000000..76eaa44546e --- /dev/null +++ b/gnu/llvm/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp @@ -0,0 +1,67 @@ +//===-- ArchitecturePPC64.cpp -----------------------------------*- C++ -*-===// +// +// 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 "Plugins/Architecture/PPC64/ArchitecturePPC64.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/Symbol.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Thread.h" +#include "lldb/Utility/ArchSpec.h" + +#include "llvm/BinaryFormat/ELF.h" + +using namespace lldb_private; +using namespace lldb; + +ConstString ArchitecturePPC64::GetPluginNameStatic() { + return ConstString("ppc64"); +} + +void ArchitecturePPC64::Initialize() { + PluginManager::RegisterPlugin(GetPluginNameStatic(), + "PPC64-specific algorithms", + &ArchitecturePPC64::Create); +} + +void ArchitecturePPC64::Terminate() { + PluginManager::UnregisterPlugin(&ArchitecturePPC64::Create); +} + +std::unique_ptr<Architecture> ArchitecturePPC64::Create(const ArchSpec &arch) { + if (arch.GetTriple().isPPC64() && + arch.GetTriple().getObjectFormat() == llvm::Triple::ObjectFormatType::ELF) + return std::unique_ptr<Architecture>(new ArchitecturePPC64()); + return nullptr; +} + +ConstString ArchitecturePPC64::GetPluginName() { return GetPluginNameStatic(); } +uint32_t ArchitecturePPC64::GetPluginVersion() { return 1; } + +static int32_t GetLocalEntryOffset(const Symbol &sym) { + unsigned char other = sym.GetFlags() >> 8 & 0xFF; + return llvm::ELF::decodePPC64LocalEntryOffset(other); +} + +size_t ArchitecturePPC64::GetBytesToSkip(Symbol &func, + const Address &curr_addr) const { + if (curr_addr.GetFileAddress() == + func.GetFileAddress() + GetLocalEntryOffset(func)) + return func.GetPrologueByteSize(); + return 0; +} + +void ArchitecturePPC64::AdjustBreakpointAddress(const Symbol &func, + Address &addr) const { + int32_t loffs = GetLocalEntryOffset(func); + if (!loffs) + return; + + addr.SetOffset(addr.GetOffset() + loffs); +} |