Coverage Report

Created: 2022-07-16 07:03

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp
Line
Count
Source (jump to first uncovered line)
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
9
#include "Plugins/Architecture/PPC64/ArchitecturePPC64.h"
10
#include "lldb/Core/PluginManager.h"
11
#include "lldb/Symbol/Function.h"
12
#include "lldb/Symbol/Symbol.h"
13
#include "lldb/Target/RegisterContext.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
23
LLDB_PLUGIN_DEFINE(ArchitecturePPC64)
24
25
3.61k
void ArchitecturePPC64::Initialize() {
26
3.61k
  PluginManager::RegisterPlugin(GetPluginNameStatic(),
27
3.61k
                                "PPC64-specific algorithms",
28
3.61k
                                &ArchitecturePPC64::Create);
29
3.61k
}
30
31
3.60k
void ArchitecturePPC64::Terminate() {
32
3.60k
  PluginManager::UnregisterPlugin(&ArchitecturePPC64::Create);
33
3.60k
}
34
35
12.8k
std::unique_ptr<Architecture> ArchitecturePPC64::Create(const ArchSpec &arch) {
36
12.8k
  if (arch.GetTriple().isPPC64() &&
37
12.8k
      
arch.GetTriple().getObjectFormat() == llvm::Triple::ObjectFormatType::ELF0
)
38
0
    return std::unique_ptr<Architecture>(new ArchitecturePPC64());
39
12.8k
  return nullptr;
40
12.8k
}
41
42
0
static int32_t GetLocalEntryOffset(const Symbol &sym) {
43
0
  unsigned char other = sym.GetFlags() >> 8 & 0xFF;
44
0
  return llvm::ELF::decodePPC64LocalEntryOffset(other);
45
0
}
46
47
size_t ArchitecturePPC64::GetBytesToSkip(Symbol &func,
48
0
                                         const Address &curr_addr) const {
49
0
  if (curr_addr.GetFileAddress() ==
50
0
      func.GetFileAddress() + GetLocalEntryOffset(func))
51
0
    return func.GetPrologueByteSize();
52
0
  return 0;
53
0
}
54
55
void ArchitecturePPC64::AdjustBreakpointAddress(const Symbol &func,
56
0
                                                Address &addr) const {
57
0
  int32_t loffs = GetLocalEntryOffset(func);
58
0
  if (!loffs)
59
0
    return;
60
61
0
  addr.SetOffset(addr.GetOffset() + loffs);
62
0
}