LLDB  mainline
ObjectFileBreakpad.h
Go to the documentation of this file.
1 //===-- ObjectFileBreakpad.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_BREAKPAD_OBJECTFILEBREAKPAD_H
10 #define LLDB_SOURCE_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H
11 
12 #include "lldb/Symbol/ObjectFile.h"
13 #include "lldb/Utility/ArchSpec.h"
14 
15 namespace lldb_private {
16 namespace breakpad {
17 
19 public:
20  // Static Functions
21  static void Initialize();
22  static void Terminate();
23 
25  static const char *GetPluginDescriptionStatic() {
26  return "Breakpad object file reader.";
27  }
28 
29  static ObjectFile *
30  CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
31  lldb::offset_t data_offset, const FileSpec *file,
32  lldb::offset_t file_offset, lldb::offset_t length);
33 
34  static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP &module_sp,
35  lldb::DataBufferSP &data_sp,
36  const lldb::ProcessSP &process_sp,
37  lldb::addr_t header_addr);
38 
39  static size_t GetModuleSpecifications(const FileSpec &file,
40  lldb::DataBufferSP &data_sp,
41  lldb::offset_t data_offset,
42  lldb::offset_t file_offset,
43  lldb::offset_t length,
44  ModuleSpecList &specs);
45 
46  // PluginInterface protocol
48 
49  uint32_t GetPluginVersion() override { return 1; }
50 
51  // LLVM RTTI support
52  static char ID;
53  bool isA(const void *ClassID) const override {
54  return ClassID == &ID || ObjectFile::isA(ClassID);
55  }
56  static bool classof(const ObjectFile *obj) { return obj->isA(&ID); }
57 
58  // ObjectFile Protocol.
59 
60  bool ParseHeader() override;
61 
62  lldb::ByteOrder GetByteOrder() const override {
63  return m_arch.GetByteOrder();
64  }
65 
66  bool IsExecutable() const override { return false; }
67 
68  uint32_t GetAddressByteSize() const override {
69  return m_arch.GetAddressByteSize();
70  }
71 
74  }
75 
76  Symtab *GetSymtab() override;
77 
78  bool IsStripped() override { return false; }
79 
80  void CreateSections(SectionList &unified_section_list) override;
81 
82  void Dump(Stream *s) override {}
83 
84  ArchSpec GetArchitecture() override { return m_arch; }
85 
86  UUID GetUUID() override { return m_uuid; }
87 
88  uint32_t GetDependentModules(FileSpecList &files) override { return 0; }
89 
90  Type CalculateType() override { return eTypeDebugInfo; }
91 
92  Strata CalculateStrata() override { return eStrataUser; }
93 
94 private:
97 
98  ObjectFileBreakpad(const lldb::ModuleSP &module_sp,
99  lldb::DataBufferSP &data_sp, lldb::offset_t data_offset,
100  const FileSpec *file, lldb::offset_t offset,
101  lldb::offset_t length, ArchSpec arch, UUID uuid);
102 };
103 
104 } // namespace breakpad
105 } // namespace lldb_private
106 #endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H
Symtab * GetSymtab() override
Gets the symbol table for the currently selected architecture (and object for archives).
A class that represents a running process on the host machine.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:730
ObjectFileBreakpad(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length, ArchSpec arch, UUID uuid)
A file utility class.
Definition: FileSpec.h:56
An architecture specification class.
Definition: ArchSpec.h:33
bool IsExecutable() const override
Tells whether this object file is capable of being the main executable for a process.
A plug-in interface definition class for object file parsers.
Definition: ObjectFile.h:58
lldb::ByteOrder GetByteOrder() const override
Gets whether endian swapping should occur when extracting data from this object file.
uint32_t GetDependentModules(FileSpecList &files) override
Extract the dependent modules from an object file.
Strata CalculateStrata() override
The object file should be able to calculate the strata of the object file.
static size_t GetModuleSpecifications(const FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, ModuleSpecList &specs)
bool isA(const void *ClassID) const override
An object file that contains only debug information.
Definition: ObjectFile.h:71
ArchSpec GetArchitecture() override
Get the ArchSpec for this object file.
bool IsStripped() override
Detect if this object file has been stripped of local symbols.
static ObjectFile * CreateMemoryInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr)
uint64_t offset_t
Definition: lldb-types.h:87
UUID GetUUID() override
Gets the UUID for this object file.
void CreateSections(SectionList &unified_section_list) override
ByteOrder
Byte ordering definitions.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition: ArchSpec.cpp:777
void Dump(Stream *s) override
Dump a description of this object to a Stream.
static bool classof(const ObjectFile *obj)
AddressClass GetAddressClass(lldb::addr_t file_addr) override
Get the address type given a file address in an object file.
bool ParseHeader() override
Attempts to parse the object header.
uint64_t addr_t
Definition: lldb-types.h:83
A uniqued constant string class.
Definition: ConstString.h:40
virtual bool isA(const void *ClassID) const
Definition: ObjectFile.h:215
uint32_t GetAddressByteSize() const override
Gets the address size in bytes for the current object file.
static ObjectFile * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
Type CalculateType() override
The object file should be able to calculate its type by looking at its file header and possibly the s...