1 //===-- ObjectFileBreakpad.h ---------------------------------- -*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H
10 #define LLDB_SOURCE_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H
12 #include "lldb/Symbol/ObjectFile.h"
13 #include "lldb/Utility/ArchSpec.h"
15 namespace lldb_private
{
18 class ObjectFileBreakpad
: public ObjectFile
{
21 static void Initialize();
22 static void Terminate();
24 static llvm::StringRef
GetPluginNameStatic() { return "breakpad"; }
25 static const char *GetPluginDescriptionStatic() {
26 return "Breakpad object file reader.";
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
);
34 static ObjectFile
*CreateMemoryInstance(const lldb::ModuleSP
&module_sp
,
35 lldb::WritableDataBufferSP data_sp
,
36 const lldb::ProcessSP
&process_sp
,
37 lldb::addr_t header_addr
);
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
);
46 // PluginInterface protocol
47 llvm::StringRef
GetPluginName() override
{ return GetPluginNameStatic(); }
51 bool isA(const void *ClassID
) const override
{
52 return ClassID
== &ID
|| ObjectFile::isA(ClassID
);
54 static bool classof(const ObjectFile
*obj
) { return obj
->isA(&ID
); }
56 // ObjectFile Protocol.
58 bool ParseHeader() override
;
60 lldb::ByteOrder
GetByteOrder() const override
{
61 return m_arch
.GetByteOrder();
64 bool IsExecutable() const override
{ return false; }
66 uint32_t GetAddressByteSize() const override
{
67 return m_arch
.GetAddressByteSize();
70 AddressClass
GetAddressClass(lldb::addr_t file_addr
) override
{
71 return AddressClass::eInvalid
;
74 void ParseSymtab(lldb_private::Symtab
&symtab
) override
;
76 bool IsStripped() override
{ return false; }
78 void CreateSections(SectionList
&unified_section_list
) override
;
80 void Dump(Stream
*s
) override
{}
82 ArchSpec
GetArchitecture() override
{ return m_arch
; }
84 UUID
GetUUID() override
{ return m_uuid
; }
86 uint32_t GetDependentModules(FileSpecList
&files
) override
{ return 0; }
88 Type
CalculateType() override
{ return eTypeDebugInfo
; }
90 Strata
CalculateStrata() override
{ return eStrataUser
; }
96 ObjectFileBreakpad(const lldb::ModuleSP
&module_sp
,
97 lldb::DataBufferSP
&data_sp
, lldb::offset_t data_offset
,
98 const FileSpec
*file
, lldb::offset_t offset
,
99 lldb::offset_t length
, ArchSpec arch
, UUID uuid
);
102 } // namespace breakpad
103 } // namespace lldb_private
104 #endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_BREAKPAD_OBJECTFILEBREAKPAD_H