LLDB mainline
ObjectContainerMachOFileset.h
Go to the documentation of this file.
1//===-- ObjectContainerMachOFileset.h ---------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_MACH_O_FILESET_OBJECTCONTAINERMADCHOFILESET_H
10#define LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_MACH_O_FILESET_OBJECTCONTAINERMADCHOFILESET_H
11
12#include "lldb/Host/SafeMachO.h"
15
16namespace lldb_private {
17
19public:
21 lldb::DataBufferSP &data_sp,
22 lldb::offset_t data_offset,
23 const lldb_private::FileSpec *file,
24 lldb::offset_t offset, lldb::offset_t length);
25
28 const lldb::ProcessSP &process_sp,
29 lldb::addr_t header_addr);
30
32
33 static void Initialize();
34 static void Terminate();
35
36 static llvm::StringRef GetPluginNameStatic() { return "mach-o-fileset"; }
37
38 static llvm::StringRef GetPluginDescriptionStatic() {
39 return "Mach-O Fileset container reader.";
40 }
41
43 CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
44 lldb::offset_t data_offset, const lldb_private::FileSpec *file,
45 lldb::offset_t offset, lldb::offset_t length);
46
48 const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
49 const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
50
51 static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
52 lldb::DataBufferSP &data_sp,
53 lldb::offset_t data_offset,
54 lldb::offset_t file_offset,
55 lldb::offset_t length,
57
58 static bool MagicBytesMatch(const lldb_private::DataExtractor &data);
59 static bool MagicBytesMatch(lldb::DataBufferSP data_sp,
60 lldb::addr_t data_offset,
61 lldb::addr_t data_length);
62
63 bool ParseHeader() override;
64
65 size_t GetNumObjects() const override { return m_entries.size(); }
66
68
69 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
70
71 struct Entry {
72 Entry(uint64_t vmaddr, uint64_t fileoff, std::string id)
74 uint64_t vmaddr;
75 uint64_t fileoff;
76 std::string id;
77 };
78
79 Entry *FindEntry(llvm::StringRef id);
80
81private:
83 const lldb_private::FileSpec &file,
84 lldb::offset_t file_offset,
85 std::vector<Entry> &entries);
86
87 std::vector<Entry> m_entries;
90};
91
92} // namespace lldb_private
93
94#endif // LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_MACH_O_FILESET_OBJECTCONTAINERMADCHOFILESET_H
An data extractor class.
Definition: DataExtractor.h:48
A file utility class.
Definition: FileSpec.h:56
size_t GetNumObjects() const override
Get the number of objects within this object file (archives).
static bool MagicBytesMatch(const lldb_private::DataExtractor &data)
static lldb_private::ObjectContainer * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, lldb::offset_t offset, lldb::offset_t length)
static lldb_private::ObjectContainer * 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 lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, lldb_private::ModuleSpecList &specs)
bool ParseHeader() override
Attempts to parse the object header.
lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override
Selects an architecture in an object file.
A plug-in interface definition class for object containers.
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
uint64_t offset_t
Definition: lldb-types.h:83
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
Definition: lldb-forward.h:356
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:368
std::weak_ptr< lldb_private::Process > ProcessWP
Definition: lldb-forward.h:371
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:318
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:319
uint64_t addr_t
Definition: lldb-types.h:79
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:354
Entry(uint64_t vmaddr, uint64_t fileoff, std::string id)