Coverage Report

Created: 2022-01-15 10:30

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
Line
Count
Source (jump to first uncovered line)
1
//===-- ObjectFileJIT.h -----------------------------------------*- C++ -*-===//
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
#ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H
10
#define LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H
11
12
#include "lldb/Core/Address.h"
13
#include "lldb/Symbol/ObjectFile.h"
14
15
// This class needs to be hidden as eventually belongs in a plugin that
16
// will export the ObjectFile protocol
17
class ObjectFileJIT : public lldb_private::ObjectFile {
18
public:
19
  ObjectFileJIT(const lldb::ModuleSP &module_sp,
20
                const lldb::ObjectFileJITDelegateSP &delegate_sp);
21
22
  ~ObjectFileJIT() override;
23
24
  // Static Functions
25
  static void Initialize();
26
27
  static void Terminate();
28
29
3.43k
  static llvm::StringRef GetPluginNameStatic() { return "jit"; }
30
31
3.43k
  static llvm::StringRef GetPluginDescriptionStatic() {
32
3.43k
    return "JIT code object file";
33
3.43k
  }
34
35
  static lldb_private::ObjectFile *
36
  CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
37
                 lldb::offset_t data_offset, const lldb_private::FileSpec *file,
38
                 lldb::offset_t file_offset, lldb::offset_t length);
39
40
  static lldb_private::ObjectFile *CreateMemoryInstance(
41
      const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
42
      const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
43
44
  static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
45
                                        lldb::DataBufferSP &data_sp,
46
                                        lldb::offset_t data_offset,
47
                                        lldb::offset_t file_offset,
48
                                        lldb::offset_t length,
49
                                        lldb_private::ModuleSpecList &specs);
50
51
  // LLVM RTTI support
52
  static char ID;
53
23.7k
  bool isA(const void *ClassID) const override {
54
23.7k
    return ClassID == &ID || ObjectFile::isA(ClassID);
55
23.7k
  }
56
0
  static bool classof(const ObjectFile *obj) { return obj->isA(&ID); }
57
58
  // Member Functions
59
  bool ParseHeader() override;
60
61
  bool SetLoadAddress(lldb_private::Target &target, lldb::addr_t value,
62
                      bool value_is_offset) override;
63
64
  lldb::ByteOrder GetByteOrder() const override;
65
66
  bool IsExecutable() const override;
67
68
  uint32_t GetAddressByteSize() const override;
69
70
  void ParseSymtab(lldb_private::Symtab &symtab) override;
71
72
  bool IsStripped() override;
73
74
  void CreateSections(lldb_private::SectionList &unified_section_list) override;
75
76
  void Dump(lldb_private::Stream *s) override;
77
78
  lldb_private::ArchSpec GetArchitecture() override;
79
80
  lldb_private::UUID GetUUID() override;
81
82
  uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;
83
84
  size_t ReadSectionData(lldb_private::Section *section,
85
                         lldb::offset_t section_offset, void *dst,
86
                         size_t dst_len) override;
87
88
  size_t
89
  ReadSectionData(lldb_private::Section *section,
90
                  lldb_private::DataExtractor &section_data) override;
91
92
  lldb_private::Address GetEntryPointAddress() override;
93
94
  lldb_private::Address GetBaseAddress() override;
95
96
  ObjectFile::Type CalculateType() override;
97
98
  ObjectFile::Strata CalculateStrata() override;
99
100
  // PluginInterface protocol
101
0
  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
102
103
protected:
104
  lldb::ObjectFileJITDelegateWP m_delegate_wp;
105
};
106
107
#endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_JIT_OBJECTFILEJIT_H