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 
11 #include "lldb/Symbol/Function.h"
12 #include "lldb/Symbol/Symbol.h"
14 #include "lldb/Target/Target.h"
15 #include "lldb/Target/Thread.h"
16 #include "lldb/Utility/ArchSpec.h"
17 
18 #include "llvm/BinaryFormat/ELF.h"
19 
20 using namespace lldb_private;
21 using namespace lldb;
22 
24 
25 void ArchitecturePPC64::Initialize() {
26  PluginManager::RegisterPlugin(GetPluginNameStatic(),
27  "PPC64-specific algorithms",
29 }
30 
33 }
34 
35 std::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 
42 static 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() ==
50  func.GetFileAddress() + GetLocalEntryOffset(func))
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 }
GetLocalEntryOffset
static int32_t GetLocalEntryOffset(const Symbol &sym)
Definition: ArchitecturePPC64.cpp:42
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::Symbol::GetPrologueByteSize
uint32_t GetPrologueByteSize()
Definition: Symbol.cpp:259
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:444
Target.h
lldb_private::Symbol::GetFlags
uint32_t GetFlags() const
Definition: Symbol.h:149
lldb_private::PluginManager::UnregisterPlugin
static bool UnregisterPlugin(ABICreateInstance create_callback)
Definition: PluginManager.cpp:295
lldb_private::Address::GetFileAddress
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:290
lldb_private::ArchitecturePPC64::GetBytesToSkip
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...
Definition: ArchitecturePPC64.cpp:47
ArchitecturePPC64.h
lldb_private::ArchitecturePPC64::AdjustBreakpointAddress
void AdjustBreakpointAddress(const Symbol &func, Address &addr) const override
Adjust function breakpoint address, if needed.
Definition: ArchitecturePPC64.cpp:55
lldb_private::ArchitecturePPC64::Terminate
static void Terminate()
Definition: ArchitecturePPC64.cpp:31
Thread.h
Symbol.h
lldb_private::Address
Definition: Address.h:59
lldb_private::ArchitecturePPC64
Definition: ArchitecturePPC64.h:16
ArchSpec.h
lldb_private::Symbol::GetFileAddress
lldb::addr_t GetFileAddress() const
Definition: Symbol.cpp:486
PluginManager.h
lldb_private::Address::SetOffset
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
Definition: Address.h:429
Function.h
lldb_private::PluginManager::RegisterPlugin
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
Definition: PluginManager.cpp:288
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::Address::GetOffset
lldb::addr_t GetOffset() const
Get the section relative offset value.
Definition: Address.h:310
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb
Definition: SBAddress.h:15
lldb_private::ArchitecturePPC64::Create
static std::unique_ptr< Architecture > Create(const ArchSpec &arch)
Definition: ArchitecturePPC64.cpp:35
RegisterContext.h