Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
39644 views
//===-- NativeProcessELF.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 liblldb_NativeProcessELF_H_9#define liblldb_NativeProcessELF_H_1011#include "Plugins/Process/Utility/AuxVector.h"12#include "lldb/Host/common/NativeProcessProtocol.h"13#include "llvm/BinaryFormat/ELF.h"14#include <optional>1516namespace lldb_private {1718/// \class NativeProcessELF19/// Abstract class that extends \a NativeProcessProtocol with ELF specific20/// logic. Meant to be subclassed by ELF based NativeProcess* implementations.21class NativeProcessELF : public NativeProcessProtocol {22using NativeProcessProtocol::NativeProcessProtocol;2324public:25std::optional<uint64_t> GetAuxValue(enum AuxVector::EntryType type);2627protected:28template <typename T> struct ELFLinkMap {29T l_addr;30T l_name;31T l_ld;32T l_next;33T l_prev;34};3536lldb::addr_t GetSharedLibraryInfoAddress() override;3738template <typename ELF_EHDR, typename ELF_PHDR, typename ELF_DYN>39lldb::addr_t GetELFImageInfoAddress();4041llvm::Expected<std::vector<SVR4LibraryInfo>>42GetLoadedSVR4Libraries() override;4344template <typename T>45llvm::Expected<SVR4LibraryInfo>46ReadSVR4LibraryInfo(lldb::addr_t link_map_addr);4748void NotifyDidExec() override;4950std::unique_ptr<AuxVector> m_aux_vector;51std::optional<lldb::addr_t> m_shared_library_info_addr;52};5354// Explicitly declare the two 32/64 bit templates that NativeProcessELF.cpp will55// define. This allows us to keep the template definition here and usable56// elsewhere.57extern template lldb::addr_t NativeProcessELF::GetELFImageInfoAddress<58llvm::ELF::Elf32_Ehdr, llvm::ELF::Elf32_Phdr, llvm::ELF::Elf32_Dyn>();59extern template lldb::addr_t NativeProcessELF::GetELFImageInfoAddress<60llvm::ELF::Elf64_Ehdr, llvm::ELF::Elf64_Phdr, llvm::ELF::Elf64_Dyn>();6162} // namespace lldb_private6364#endif656667