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)};
66 if (!extractor_sp || !extractor_sp->HasData()) {
70 extractor_sp = std::make_shared<DataExtractor>(data_sp);
73 auto text = toStringRef(extractor_sp->GetSharedDataBuffer()->GetData());
74 std::optional<Header> header = Header::parse(text);
79 if (extractor_sp->GetByteSize() < length) {
84 extractor_sp = std::make_shared<DataExtractor>(data_sp);
89 file_offset, length, std::move(header->arch),
90 std::move(header->uuid));
102 auto text = toStringRef(data_sp->GetData());
103 std::optional<Header> header = Header::parse(text);
106 ModuleSpec spec(file, std::move(header->arch));
107 spec.
GetUUID() = std::move(header->uuid);
118 :
ObjectFile(module_sp, file, offset, length, extractor_sp, data_offset),
137 std::optional<Record::Kind> current_section;
139 llvm::StringRef text = toStringRef(
m_data_nsp->GetData());
140 uint32_t next_section_id = 1;
141 auto maybe_add_section = [&](
const uint8_t *end_ptr) {
142 if (!current_section)
146 auto section_sp = std::make_shared<Section>(
150 end_offset - section_start, 0, 0);
154 while (!text.empty()) {
155 llvm::StringRef line;
156 std::tie(line, text) = text.split(
'\n');
164 if (next_section == current_section)
168 maybe_add_section(line.bytes_begin());
170 current_section = next_section;
171 section_start = line.bytes_begin() -
m_data_nsp->GetDataStart();
#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)
std::unique_ptr< lldb_private::SectionList > m_sections_up
static lldb::DataBufferSP MapFileData(const FileSpec &file, uint64_t Size, uint64_t Offset)
DataExtractorNSP m_data_nsp
The data for this object file so things can be parsed lazily.
ObjectFile(const lldb::ModuleSP &module_sp, const FileSpec *file_spec_ptr, lldb::offset_t file_offset, lldb::offset_t length, lldb::DataExtractorSP extractor_sp, lldb::offset_t data_offset)
Construct with a parent module, offset, and header data.
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)
Represents UUID's of various sizes.
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)
ObjectFileBreakpad(const lldb::ModuleSP &module_sp, lldb::DataExtractorSP extractor_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length, ArchSpec arch, UUID uuid)
static llvm::StringRef GetPluginNameStatic()
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.
static ObjectFile * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataExtractorSP extractor_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
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::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::Module > ModuleSP