Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 1 | //===-- ObjectFileBreakpad.h ---------------------------------- -*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLDB_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H |
| 10 | #define LLDB_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H |
| 11 | |
| 12 | #include "lldb/Symbol/ObjectFile.h" |
| 13 | #include "lldb/Utility/ArchSpec.h" |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 14 | |
| 15 | namespace lldb_private { |
| 16 | namespace breakpad { |
| 17 | |
| 18 | class ObjectFileBreakpad : public ObjectFile { |
| 19 | public: |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 20 | // Static Functions |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 21 | static void Initialize(); |
| 22 | static void Terminate(); |
| 23 | |
| 24 | static ConstString GetPluginNameStatic(); |
| 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 | |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 46 | // PluginInterface protocol |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 47 | ConstString GetPluginName() override { return GetPluginNameStatic(); } |
| 48 | |
| 49 | uint32_t GetPluginVersion() override { return 1; } |
| 50 | |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 51 | // ObjectFile Protocol. |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 52 | |
| 53 | bool ParseHeader() override; |
| 54 | |
| 55 | lldb::ByteOrder GetByteOrder() const override { |
| 56 | return m_arch.GetByteOrder(); |
| 57 | } |
| 58 | |
| 59 | bool IsExecutable() const override { return false; } |
| 60 | |
| 61 | uint32_t GetAddressByteSize() const override { |
| 62 | return m_arch.GetAddressByteSize(); |
| 63 | } |
| 64 | |
| 65 | AddressClass GetAddressClass(lldb::addr_t file_addr) override { |
| 66 | return AddressClass::eInvalid; |
| 67 | } |
| 68 | |
| 69 | Symtab *GetSymtab() override; |
| 70 | |
| 71 | bool IsStripped() override { return false; } |
| 72 | |
| 73 | void CreateSections(SectionList &unified_section_list) override; |
| 74 | |
| 75 | void Dump(Stream *s) override {} |
| 76 | |
Pavel Labath | f760f5a | 2019-01-03 10:37:19 +0000 | [diff] [blame] | 77 | ArchSpec GetArchitecture() override { return m_arch; } |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 78 | |
Pavel Labath | bd334ef | 2019-02-11 16:14:02 +0000 | [diff] [blame] | 79 | UUID GetUUID() override { return m_uuid; } |
Pavel Labath | 1f6b247 | 2018-12-10 17:16:38 +0000 | [diff] [blame] | 80 | |
| 81 | FileSpecList GetDebugSymbolFilePaths() override { return FileSpecList(); } |
| 82 | |
| 83 | uint32_t GetDependentModules(FileSpecList &files) override { return 0; } |
| 84 | |
| 85 | Type CalculateType() override { return eTypeDebugInfo; } |
| 86 | |
| 87 | Strata CalculateStrata() override { return eStrataUser; } |
| 88 | |
| 89 | private: |
| 90 | ArchSpec m_arch; |
| 91 | UUID m_uuid; |
| 92 | |
| 93 | ObjectFileBreakpad(const lldb::ModuleSP &module_sp, |
| 94 | lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, |
| 95 | const FileSpec *file, lldb::offset_t offset, |
| 96 | lldb::offset_t length, ArchSpec arch, UUID uuid); |
| 97 | }; |
| 98 | |
| 99 | } // namespace breakpad |
| 100 | } // namespace lldb_private |
| 101 | #endif // LLDB_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H |