1//===-- NativeProcessELF.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 liblldb_NativeProcessELF_H_ 10#define liblldb_NativeProcessELF_H_ 11 12#include "Plugins/Process/Utility/AuxVector.h" 13#include "lldb/Host/common/NativeProcessProtocol.h" 14#include "llvm/BinaryFormat/ELF.h" 15 16namespace lldb_private { 17 18/// \class NativeProcessELF 19/// Abstract class that extends \a NativeProcessProtocol with ELF specific 20/// logic. Meant to be subclassed by ELF based NativeProcess* implementations. 21class NativeProcessELF : public NativeProcessProtocol { 22 using NativeProcessProtocol::NativeProcessProtocol; 23 24protected: 25 template <typename T> struct ELFLinkMap { 26 T l_addr; 27 T l_name; 28 T l_ld; 29 T l_next; 30 T l_prev; 31 }; 32 33 llvm::Optional<uint64_t> GetAuxValue(enum AuxVector::EntryType type); 34 35 lldb::addr_t GetSharedLibraryInfoAddress() override; 36 37 template <typename ELF_EHDR, typename ELF_PHDR, typename ELF_DYN> 38 lldb::addr_t GetELFImageInfoAddress(); 39 40 llvm::Expected<std::vector<SVR4LibraryInfo>> 41 GetLoadedSVR4Libraries() override; 42 43 template <typename T> 44 llvm::Expected<SVR4LibraryInfo> 45 ReadSVR4LibraryInfo(lldb::addr_t link_map_addr); 46 47 std::unique_ptr<AuxVector> m_aux_vector; 48 llvm::Optional<lldb::addr_t> m_shared_library_info_addr; 49}; 50 51} // namespace lldb_private 52 53#endif