Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.h
39644 views
//===-- ObjectFilePDB.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_OBJECTFILE_PDB_OBJECTFILEPDB_H9#define LLDB_SOURCE_PLUGINS_OBJECTFILE_PDB_OBJECTFILEPDB_H1011#include "lldb/Symbol/ObjectFile.h"12#include "lldb/Utility/ArchSpec.h"13#include "llvm/DebugInfo/PDB/Native/NativeSession.h"14#include "llvm/DebugInfo/PDB/PDBTypes.h"1516namespace lldb_private {1718class ObjectFilePDB : public ObjectFile {19public:20// Static Functions21static void Initialize();22static void Terminate();2324static llvm::StringRef GetPluginNameStatic() { return "pdb"; }25static const char *GetPluginDescriptionStatic() {26return "PDB object file reader.";27}2829static std::unique_ptr<llvm::pdb::PDBFile>30loadPDBFile(std::string PdbPath, llvm::BumpPtrAllocator &Allocator);3132static ObjectFile *33CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp,34lldb::offset_t data_offset, const FileSpec *file,35lldb::offset_t file_offset, lldb::offset_t length);3637static ObjectFile *CreateMemoryInstance(const lldb::ModuleSP &module_sp,38lldb::WritableDataBufferSP data_sp,39const lldb::ProcessSP &process_sp,40lldb::addr_t header_addr);4142static size_t GetModuleSpecifications(const FileSpec &file,43lldb::DataBufferSP &data_sp,44lldb::offset_t data_offset,45lldb::offset_t file_offset,46lldb::offset_t length,47ModuleSpecList &specs);4849// PluginInterface protocol50llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }5152// LLVM RTTI support53static char ID;54bool isA(const void *ClassID) const override {55return ClassID == &ID || ObjectFile::isA(ClassID);56}57static bool classof(const ObjectFile *obj) { return obj->isA(&ID); }5859// ObjectFile Protocol.60uint32_t GetAddressByteSize() const override { return 8; }6162lldb::ByteOrder GetByteOrder() const override {63return lldb::eByteOrderLittle;64}6566bool ParseHeader() override { return true; }6768bool IsExecutable() const override { return false; }6970void ParseSymtab(lldb_private::Symtab &symtab) override {}7172bool IsStripped() override { return false; }7374// No section in PDB file.75void CreateSections(SectionList &unified_section_list) override {}7677void Dump(Stream *s) override {}7879ArchSpec GetArchitecture() override;8081UUID GetUUID() override { return m_uuid; }8283uint32_t GetDependentModules(FileSpecList &files) override { return 0; }8485Type CalculateType() override { return eTypeDebugInfo; }8687Strata CalculateStrata() override { return eStrataUser; }8889llvm::pdb::PDBFile &GetPDBFile() { return *m_file_up; }9091ObjectFilePDB(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,92lldb::offset_t data_offset, const FileSpec *file,93lldb::offset_t offset, lldb::offset_t length);9495private:96UUID m_uuid;97llvm::BumpPtrAllocator m_allocator;98std::unique_ptr<llvm::pdb::PDBFile> m_file_up;99100bool initPDBFile();101};102103} // namespace lldb_private104#endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_PDB_OBJECTFILEPDB_H105106107