LLDB  mainline
NativeProcessELF.h
Go to the documentation of this file.
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 
14 #include "llvm/BinaryFormat/ELF.h"
15 
16 namespace 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.
23 
24 public:
25  llvm::Optional<uint64_t> GetAuxValue(enum AuxVector::EntryType type);
26 
27 protected:
28  template <typename T> struct ELFLinkMap {
29  T l_addr;
30  T l_name;
31  T l_ld;
32  T l_next;
33  T l_prev;
34  };
35 
37 
38  template <typename ELF_EHDR, typename ELF_PHDR, typename ELF_DYN>
40 
41  llvm::Expected<std::vector<SVR4LibraryInfo>>
42  GetLoadedSVR4Libraries() override;
43 
44  template <typename T>
45  llvm::Expected<SVR4LibraryInfo>
46  ReadSVR4LibraryInfo(lldb::addr_t link_map_addr);
47 
48  std::unique_ptr<AuxVector> m_aux_vector;
49  llvm::Optional<lldb::addr_t> m_shared_library_info_addr;
50 };
51 
52 // Explicitly declare the two 32/64 bit templates that NativeProcessELF.cpp will
53 // define. This allows us to keep the template definition here and usable
54 // elsewhere.
56  llvm::ELF::Elf32_Ehdr, llvm::ELF::Elf32_Phdr, llvm::ELF::Elf32_Dyn>();
58  llvm::ELF::Elf64_Ehdr, llvm::ELF::Elf64_Phdr, llvm::ELF::Elf64_Dyn>();
59 
60 } // namespace lldb_private
61 
62 #endif
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::NativeProcessELF::GetSharedLibraryInfoAddress
lldb::addr_t GetSharedLibraryInfoAddress() override
Definition: NativeProcessELF.cpp:30
lldb_private::NativeProcessELF::ELFLinkMap::l_name
T l_name
Definition: NativeProcessELF.h:30
lldb_private::NativeProcessProtocol::NativeProcessProtocol
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate)
Definition: NativeProcessProtocol.cpp:26
AuxVector.h
NativeProcessProtocol.h
lldb_private::NativeProcessELF::GetLoadedSVR4Libraries
llvm::Expected< std::vector< SVR4LibraryInfo > > GetLoadedSVR4Libraries() override
Definition: NativeProcessELF.cpp:142
lldb_private::NativeProcessELF::ELFLinkMap::l_next
T l_next
Definition: NativeProcessELF.h:32
AuxVector::EntryType
EntryType
Constants describing the type of entry.
Definition: AuxVector.h:25
lldb_private::NativeProcessELF::GetELFImageInfoAddress
lldb::addr_t GetELFImageInfoAddress()
Definition: NativeProcessELF.cpp:46
lldb_private::NativeProcessProtocol
Definition: NativeProcessProtocol.h:47
lldb_private::NativeProcessELF::ELFLinkMap::l_prev
T l_prev
Definition: NativeProcessELF.h:33
lldb_private::NativeProcessELF::GetAuxValue
llvm::Optional< uint64_t > GetAuxValue(enum AuxVector::EntryType type)
Definition: NativeProcessELF.cpp:16
lldb_private::NativeProcessELF::ELFLinkMap::l_ld
T l_ld
Definition: NativeProcessELF.h:31
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::NativeProcessELF::ELFLinkMap::l_addr
T l_addr
Definition: NativeProcessELF.h:29
lldb_private::NativeProcessELF
Definition: NativeProcessELF.h:21
lldb_private::NativeProcessELF::ReadSVR4LibraryInfo
llvm::Expected< SVR4LibraryInfo > ReadSVR4LibraryInfo(lldb::addr_t link_map_addr)
Definition: NativeProcessELF.cpp:117
lldb_private::NativeProcessELF::m_aux_vector
std::unique_ptr< AuxVector > m_aux_vector
Definition: NativeProcessELF.h:48
lldb_private::NativeProcessELF::m_shared_library_info_addr
llvm::Optional< lldb::addr_t > m_shared_library_info_addr
Definition: NativeProcessELF.h:49
lldb_private::NativeProcessELF::ELFLinkMap
Definition: NativeProcessELF.h:28