26 static std::optional<Header> parse(llvm::StringRef text);
30std::optional<Header> Header::parse(llvm::StringRef text) {
32 std::tie(line, text) = text.split(
'\n');
38 triple.setArch(
Module->Arch);
41 std::tie(line, text) = text.split(
'\n');
44 UUID uuid = Info && Info->ID ? Info->ID :
Module->ID;
45 return Header{
ArchSpec(triple), std::move(uuid)};
69 auto text = toStringRef(data_sp->GetData());
70 std::optional<Header> header = Header::parse(text);
75 if (data_sp->GetByteSize() < length) {
83 file_offset, length, std::move(header->arch),
84 std::move(header->uuid));
96 auto text = toStringRef(data_sp->GetData());
97 std::optional<Header> header = Header::parse(text);
100 ModuleSpec spec(file, std::move(header->arch));
101 spec.
GetUUID() = std::move(header->uuid);
112 :
ObjectFile(module_sp, file, offset, length, data_sp, data_offset),
113 m_arch(std::move(arch)), m_uuid(std::move(uuid)) {}
131 std::optional<Record::Kind> current_section;
134 uint32_t next_section_id = 1;
135 auto maybe_add_section = [&](
const uint8_t *end_ptr) {
136 if (!current_section)
140 auto section_sp = std::make_shared<Section>(
144 end_offset - section_start, 0, 0);
148 while (!text.empty()) {
149 llvm::StringRef line;
150 std::tie(line, text) = text.split(
'\n');
158 if (next_section == current_section)
162 maybe_add_section(line.bytes_begin());
164 current_section = next_section;
#define LLDB_PLUGIN_DEFINE(PluginName)
An architecture specification class.
A uniqued constant string class.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
void Append(const ModuleSpec &spec)
A class that describes an executable image and its associated object and symbol files.
A plug-in interface definition class for object file parsers.
DataExtractor m_data
The data for this object file so things can be parsed lazily.
std::unique_ptr< lldb_private::SectionList > m_sections_up
static lldb::DataBufferSP MapFileData(const FileSpec &file, uint64_t Size, uint64_t Offset)
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
size_t AddSection(const lldb::SectionSP §ion_sp)
static std::optional< InfoRecord > parse(llvm::StringRef Line)
static std::optional< ModuleRecord > parse(llvm::StringRef Line)
static ObjectFile * CreateMemoryInstance(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr)
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)
static llvm::StringRef GetPluginNameStatic()
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)
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)
void ParseSymtab(lldb_private::Symtab &symtab) override
Parse the symbol table into the provides symbol table object.
static const char * GetPluginDescriptionStatic()
bool ParseHeader() override
Attempts to parse the object header.
void CreateSections(SectionList &unified_section_list) override
static std::optional< Kind > classify(llvm::StringRef Line)
Attempt to guess the kind of the record present in the argument without doing a full parse.
llvm::StringRef toString(Record::Kind K)
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
std::shared_ptr< lldb_private::Module > ModuleSP