Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
39642 views
//===-- ObjectContainerMachOFileset.h ---------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_MACH_O_FILESET_OBJECTCONTAINERMADCHOFILESET_H9#define LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_MACH_O_FILESET_OBJECTCONTAINERMADCHOFILESET_H1011#include "lldb/Host/SafeMachO.h"12#include "lldb/Symbol/ObjectContainer.h"13#include "lldb/Utility/FileSpec.h"1415namespace lldb_private {1617class ObjectContainerMachOFileset : public lldb_private::ObjectContainer {18public:19ObjectContainerMachOFileset(const lldb::ModuleSP &module_sp,20lldb::DataBufferSP &data_sp,21lldb::offset_t data_offset,22const lldb_private::FileSpec *file,23lldb::offset_t offset, lldb::offset_t length);2425ObjectContainerMachOFileset(const lldb::ModuleSP &module_sp,26lldb::WritableDataBufferSP data_sp,27const lldb::ProcessSP &process_sp,28lldb::addr_t header_addr);2930~ObjectContainerMachOFileset() override;3132static void Initialize();33static void Terminate();3435static llvm::StringRef GetPluginNameStatic() { return "mach-o-fileset"; }3637static llvm::StringRef GetPluginDescriptionStatic() {38return "Mach-O Fileset container reader.";39}4041static lldb_private::ObjectContainer *42CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,43lldb::offset_t data_offset, const lldb_private::FileSpec *file,44lldb::offset_t offset, lldb::offset_t length);4546static lldb_private::ObjectContainer *CreateMemoryInstance(47const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,48const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);4950static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,51lldb::DataBufferSP &data_sp,52lldb::offset_t data_offset,53lldb::offset_t file_offset,54lldb::offset_t length,55lldb_private::ModuleSpecList &specs);5657static bool MagicBytesMatch(const lldb_private::DataExtractor &data);58static bool MagicBytesMatch(lldb::DataBufferSP data_sp,59lldb::addr_t data_offset,60lldb::addr_t data_length);6162bool ParseHeader() override;6364size_t GetNumObjects() const override { return m_entries.size(); }6566lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override;6768llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }6970struct Entry {71Entry(uint64_t vmaddr, uint64_t fileoff, std::string id)72: vmaddr(vmaddr), fileoff(fileoff), id(id) {}73uint64_t vmaddr;74uint64_t fileoff;75std::string id;76};7778Entry *FindEntry(llvm::StringRef id);7980private:81static bool ParseHeader(lldb_private::DataExtractor &data,82const lldb_private::FileSpec &file,83lldb::offset_t file_offset,84std::vector<Entry> &entries);8586std::vector<Entry> m_entries;87lldb::ProcessWP m_process_wp;88const lldb::addr_t m_memory_addr;89};9091} // namespace lldb_private9293#endif // LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_MACH_O_FILESET_OBJECTCONTAINERMADCHOFILESET_H949596