LLDB mainline
ArchitecturePPC64.cpp
Go to the documentation of this file.
1//===-- ArchitecturePPC64.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
12#include "lldb/Symbol/Symbol.h"
14#include "lldb/Target/Target.h"
15#include "lldb/Target/Thread.h"
17
18#include "llvm/BinaryFormat/ELF.h"
19
20using namespace lldb_private;
21using namespace lldb;
22
24
25void ArchitecturePPC64::Initialize() {
26 PluginManager::RegisterPlugin(GetPluginNameStatic(),
27 "PPC64-specific algorithms",
29}
30
33}
34
35std::unique_ptr<Architecture> ArchitecturePPC64::Create(const ArchSpec &arch) {
36 if (arch.GetTriple().isPPC64() &&
37 arch.GetTriple().getObjectFormat() == llvm::Triple::ObjectFormatType::ELF)
38 return std::unique_ptr<Architecture>(new ArchitecturePPC64());
39 return nullptr;
40}
41
42static int32_t GetLocalEntryOffset(const Symbol &sym) {
43 unsigned char other = sym.GetFlags() >> 8 & 0xFF;
44 return llvm::ELF::decodePPC64LocalEntryOffset(other);
45}
46
48 const Address &curr_addr) const {
49 if (curr_addr.GetFileAddress() ==
51 return func.GetPrologueByteSize();
52 return 0;
53}
54
56 Address &addr) const {
57 int32_t loffs = GetLocalEntryOffset(func);
58 if (!loffs)
59 return;
60
61 addr.SetOffset(addr.GetOffset() + loffs);
62}
static int32_t GetLocalEntryOffset(const Symbol &sym)
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
A section + offset based address class.
Definition: Address.h:62
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:293
lldb::addr_t GetOffset() const
Get the section relative offset value.
Definition: Address.h:329
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
Definition: Address.h:448
An architecture specification class.
Definition: ArchSpec.h:31
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:450
size_t GetBytesToSkip(Symbol &func, const Address &curr_addr) const override
This method compares current address with current function's local entry point, returning the bytes t...
static std::unique_ptr< Architecture > Create(const ArchSpec &arch)
void AdjustBreakpointAddress(const Symbol &func, Address &addr) const override
Adjust function breakpoint address, if needed.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
lldb::addr_t GetFileAddress() const
Definition: Symbol.cpp:534
uint32_t GetFlags() const
Definition: Symbol.h:174
uint32_t GetPrologueByteSize()
Definition: Symbol.cpp:313
A class that represents a running process on the host machine.
Definition: SBAddress.h:15