Coverage Report

Created: 2022-01-22 13:19

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
Line
Count
Source (jump to first uncovered line)
1
//===-- ObjectContainerUniversalMachO.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_OBJECTCONTAINER_UNIVERSAL_MACH_O_OBJECTCONTAINERUNIVERSALMACHO_H
10
#define LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_UNIVERSAL_MACH_O_OBJECTCONTAINERUNIVERSALMACHO_H
11
12
#include "lldb/Host/SafeMachO.h"
13
#include "lldb/Symbol/ObjectContainer.h"
14
#include "lldb/Utility/FileSpec.h"
15
16
class ObjectContainerUniversalMachO : public lldb_private::ObjectContainer {
17
public:
18
  ObjectContainerUniversalMachO(const lldb::ModuleSP &module_sp,
19
                                lldb::DataBufferSP &data_sp,
20
                                lldb::offset_t data_offset,
21
                                const lldb_private::FileSpec *file,
22
                                lldb::offset_t offset, lldb::offset_t length);
23
24
  ~ObjectContainerUniversalMachO() override;
25
26
  // Static Functions
27
  static void Initialize();
28
29
  static void Terminate();
30
31
3.44k
  static llvm::StringRef GetPluginNameStatic() { return "mach-o"; }
32
33
3.44k
  static llvm::StringRef GetPluginDescriptionStatic() {
34
3.44k
    return "Universal mach-o object container reader.";
35
3.44k
  }
36
37
  static lldb_private::ObjectContainer *
38
  CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
39
                 lldb::offset_t data_offset, const lldb_private::FileSpec *file,
40
                 lldb::offset_t offset, lldb::offset_t length);
41
42
  static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
43
                                        lldb::DataBufferSP &data_sp,
44
                                        lldb::offset_t data_offset,
45
                                        lldb::offset_t file_offset,
46
                                        lldb::offset_t length,
47
                                        lldb_private::ModuleSpecList &specs);
48
49
  static bool MagicBytesMatch(const lldb_private::DataExtractor &data);
50
51
  // Member Functions
52
  bool ParseHeader() override;
53
54
  void Dump(lldb_private::Stream *s) const override;
55
56
  size_t GetNumArchitectures() const override;
57
58
  bool GetArchitectureAtIndex(uint32_t cpu_idx,
59
                              lldb_private::ArchSpec &arch) const override;
60
61
  lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override;
62
63
  // PluginInterface protocol
64
0
  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
65
66
protected:
67
  llvm::MachO::fat_header m_header;
68
  std::vector<llvm::MachO::fat_arch> m_fat_archs;
69
70
  static bool ParseHeader(lldb_private::DataExtractor &data,
71
                          llvm::MachO::fat_header &header,
72
                          std::vector<llvm::MachO::fat_arch> &fat_archs);
73
};
74
75
#endif // LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_UNIVERSAL_MACH_O_OBJECTCONTAINERUNIVERSALMACHO_H