1 //===-- NativeProcessELF.h ------------------------------------ -*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_NativeProcessELF_H_
10 #define liblldb_NativeProcessELF_H_
12 #include "Plugins/Process/Utility/AuxVector.h"
13 #include "lldb/Host/common/NativeProcessProtocol.h"
14 #include "llvm/BinaryFormat/ELF.h"
17 namespace lldb_private
{
19 /// \class NativeProcessELF
20 /// Abstract class that extends \a NativeProcessProtocol with ELF specific
21 /// logic. Meant to be subclassed by ELF based NativeProcess* implementations.
22 class NativeProcessELF
: public NativeProcessProtocol
{
23 using NativeProcessProtocol::NativeProcessProtocol
;
26 std::optional
<uint64_t> GetAuxValue(enum AuxVector::EntryType type
);
29 template <typename T
> struct ELFLinkMap
{
37 lldb::addr_t
GetSharedLibraryInfoAddress() override
;
39 template <typename ELF_EHDR
, typename ELF_PHDR
, typename ELF_DYN
>
40 lldb::addr_t
GetELFImageInfoAddress();
42 llvm::Expected
<std::vector
<SVR4LibraryInfo
>>
43 GetLoadedSVR4Libraries() override
;
46 llvm::Expected
<SVR4LibraryInfo
>
47 ReadSVR4LibraryInfo(lldb::addr_t link_map_addr
);
49 void NotifyDidExec() override
;
51 std::unique_ptr
<AuxVector
> m_aux_vector
;
52 std::optional
<lldb::addr_t
> m_shared_library_info_addr
;
55 // Explicitly declare the two 32/64 bit templates that NativeProcessELF.cpp will
56 // define. This allows us to keep the template definition here and usable
58 extern template lldb::addr_t
NativeProcessELF::GetELFImageInfoAddress
<
59 llvm::ELF::Elf32_Ehdr
, llvm::ELF::Elf32_Phdr
, llvm::ELF::Elf32_Dyn
>();
60 extern template lldb::addr_t
NativeProcessELF::GetELFImageInfoAddress
<
61 llvm::ELF::Elf64_Ehdr
, llvm::ELF::Elf64_Phdr
, llvm::ELF::Elf64_Dyn
>();
63 } // namespace lldb_private