Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636
2019-01-19 08:50:56 +00:00

69 lines
2.3 KiB
C++

//===-- 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.GetMachine() != llvm::Triple::ppc64 &&
arch.GetMachine() != llvm::Triple::ppc64le) ||
arch.GetTriple().getObjectFormat() != llvm::Triple::ObjectFormatType::ELF)
return nullptr;
return std::unique_ptr<Architecture>(new ArchitecturePPC64());
}
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);
}