11f6b2477SPavel Labath //===-- ObjectFileBreakpad.h ---------------------------------- -*- C++ -*-===//
21f6b2477SPavel Labath //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
61f6b2477SPavel Labath //
71f6b2477SPavel Labath //===----------------------------------------------------------------------===//
81f6b2477SPavel Labath 
9cdc514e4SJonas Devlieghere #ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H
10cdc514e4SJonas Devlieghere #define LLDB_SOURCE_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H
111f6b2477SPavel Labath 
121f6b2477SPavel Labath #include "lldb/Symbol/ObjectFile.h"
131f6b2477SPavel Labath #include "lldb/Utility/ArchSpec.h"
141f6b2477SPavel Labath 
151f6b2477SPavel Labath namespace lldb_private {
161f6b2477SPavel Labath namespace breakpad {
171f6b2477SPavel Labath 
181f6b2477SPavel Labath class ObjectFileBreakpad : public ObjectFile {
191f6b2477SPavel Labath public:
201f6b2477SPavel Labath   // Static Functions
211f6b2477SPavel Labath   static void Initialize();
221f6b2477SPavel Labath   static void Terminate();
231f6b2477SPavel Labath 
GetPluginNameStatic()242ace1e57SPavel Labath   static llvm::StringRef GetPluginNameStatic() { return "breakpad"; }
GetPluginDescriptionStatic()251f6b2477SPavel Labath   static const char *GetPluginDescriptionStatic() {
261f6b2477SPavel Labath     return "Breakpad object file reader.";
271f6b2477SPavel Labath   }
281f6b2477SPavel Labath 
291f6b2477SPavel Labath   static ObjectFile *
30c69307e5SJonas Devlieghere   CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,
311f6b2477SPavel Labath                  lldb::offset_t data_offset, const FileSpec *file,
321f6b2477SPavel Labath                  lldb::offset_t file_offset, lldb::offset_t length);
331f6b2477SPavel Labath 
341f6b2477SPavel Labath   static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP &module_sp,
35*f2ea125eSJonas Devlieghere                                           lldb::WritableDataBufferSP data_sp,
361f6b2477SPavel Labath                                           const lldb::ProcessSP &process_sp,
371f6b2477SPavel Labath                                           lldb::addr_t header_addr);
381f6b2477SPavel Labath 
391f6b2477SPavel Labath   static size_t GetModuleSpecifications(const FileSpec &file,
401f6b2477SPavel Labath                                         lldb::DataBufferSP &data_sp,
411f6b2477SPavel Labath                                         lldb::offset_t data_offset,
421f6b2477SPavel Labath                                         lldb::offset_t file_offset,
431f6b2477SPavel Labath                                         lldb::offset_t length,
441f6b2477SPavel Labath                                         ModuleSpecList &specs);
451f6b2477SPavel Labath 
461f6b2477SPavel Labath   // PluginInterface protocol
GetPluginName()472ace1e57SPavel Labath   llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
481f6b2477SPavel Labath 
49e84f7841SPavel Labath   // LLVM RTTI support
50e84f7841SPavel Labath   static char ID;
isA(const void * ClassID)51e84f7841SPavel Labath   bool isA(const void *ClassID) const override {
52e84f7841SPavel Labath     return ClassID == &ID || ObjectFile::isA(ClassID);
53e84f7841SPavel Labath   }
classof(const ObjectFile * obj)54e84f7841SPavel Labath   static bool classof(const ObjectFile *obj) { return obj->isA(&ID); }
55e84f7841SPavel Labath 
561f6b2477SPavel Labath   // ObjectFile Protocol.
571f6b2477SPavel Labath 
581f6b2477SPavel Labath   bool ParseHeader() override;
591f6b2477SPavel Labath 
GetByteOrder()601f6b2477SPavel Labath   lldb::ByteOrder GetByteOrder() const override {
611f6b2477SPavel Labath     return m_arch.GetByteOrder();
621f6b2477SPavel Labath   }
631f6b2477SPavel Labath 
IsExecutable()641f6b2477SPavel Labath   bool IsExecutable() const override { return false; }
651f6b2477SPavel Labath 
GetAddressByteSize()661f6b2477SPavel Labath   uint32_t GetAddressByteSize() const override {
671f6b2477SPavel Labath     return m_arch.GetAddressByteSize();
681f6b2477SPavel Labath   }
691f6b2477SPavel Labath 
GetAddressClass(lldb::addr_t file_addr)701f6b2477SPavel Labath   AddressClass GetAddressClass(lldb::addr_t file_addr) override {
711f6b2477SPavel Labath     return AddressClass::eInvalid;
721f6b2477SPavel Labath   }
731f6b2477SPavel Labath 
747e6df41fSGreg Clayton   void ParseSymtab(lldb_private::Symtab &symtab) override;
751f6b2477SPavel Labath 
IsStripped()761f6b2477SPavel Labath   bool IsStripped() override { return false; }
771f6b2477SPavel Labath 
781f6b2477SPavel Labath   void CreateSections(SectionList &unified_section_list) override;
791f6b2477SPavel Labath 
Dump(Stream * s)801f6b2477SPavel Labath   void Dump(Stream *s) override {}
811f6b2477SPavel Labath 
GetArchitecture()82f760f5aeSPavel Labath   ArchSpec GetArchitecture() override { return m_arch; }
831f6b2477SPavel Labath 
GetUUID()84bd334efdSPavel Labath   UUID GetUUID() override { return m_uuid; }
851f6b2477SPavel Labath 
GetDependentModules(FileSpecList & files)861f6b2477SPavel Labath   uint32_t GetDependentModules(FileSpecList &files) override { return 0; }
871f6b2477SPavel Labath 
CalculateType()881f6b2477SPavel Labath   Type CalculateType() override { return eTypeDebugInfo; }
891f6b2477SPavel Labath 
CalculateStrata()901f6b2477SPavel Labath   Strata CalculateStrata() override { return eStrataUser; }
911f6b2477SPavel Labath 
921f6b2477SPavel Labath private:
931f6b2477SPavel Labath   ArchSpec m_arch;
941f6b2477SPavel Labath   UUID m_uuid;
951f6b2477SPavel Labath 
961f6b2477SPavel Labath   ObjectFileBreakpad(const lldb::ModuleSP &module_sp,
971f6b2477SPavel Labath                      lldb::DataBufferSP &data_sp, lldb::offset_t data_offset,
981f6b2477SPavel Labath                      const FileSpec *file, lldb::offset_t offset,
991f6b2477SPavel Labath                      lldb::offset_t length, ArchSpec arch, UUID uuid);
1001f6b2477SPavel Labath };
1011f6b2477SPavel Labath 
1021f6b2477SPavel Labath } // namespace breakpad
1031f6b2477SPavel Labath } // namespace lldb_private
104cdc514e4SJonas Devlieghere #endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H
105