LLDB  mainline
Macros | Functions
ObjectFileELF.cpp File Reference
#include "ObjectFileELF.h"
#include <algorithm>
#include <cassert>
#include <unordered_map>
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/Timer.h"
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Object/Decompressor.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/MipsABIFlags.h"
Include dependency graph for ObjectFileELF.cpp:

Go to the source code of this file.

Macros

#define CASE_AND_STREAM(s, def, width)
 
#define NT_PRSTATUS   1
 
#define NT_PRFPREG   2
 
#define NT_PRPSINFO   3
 
#define NT_TASKSTRUCT   4
 
#define NT_AUXV   6
 
#define NT_SIGINFO   0x53494749
 
#define NT_FILE   0x46494c45
 
#define NT_PRXFPREG   0x46e62b7f
 
#define NT_PPC_VMX   0x100
 
#define NT_PPC_SPE   0x101
 
#define NT_PPC_VSX   0x102
 
#define NT_386_TLS   0x200
 
#define NT_386_IOPERM   0x201
 
#define NT_X86_XSTATE   0x202
 
#define NT_S390_HIGH_GPRS   0x300
 
#define NT_S390_TIMER   0x301
 
#define NT_S390_TODCMP   0x302
 
#define NT_S390_TODPREG   0x303
 
#define NT_S390_CTRS   0x304
 
#define NT_S390_PREFIX   0x305
 
#define NT_S390_LAST_BREAK   0x306
 
#define NT_S390_SYSTEM_CALL   0x307
 
#define NT_S390_TDB   0x308
 
#define NT_S390_VXRS_LOW   0x309
 
#define NT_S390_VXRS_HIGH   0x30a
 
#define NT_ARM_VFP   0x400
 
#define NT_ARM_TLS   0x401
 
#define NT_ARM_HW_BREAK   0x402
 
#define NT_ARM_HW_WATCH   0x403
 
#define NT_ARM_SYSTEM_CALL   0x404
 
#define NT_METAG_CBUF   0x500
 
#define NT_METAG_RPIPE   0x501
 
#define NT_METAG_TLS   0x502
 
#define _MAKE_OSABI_CASE(x)
 
#define STO_MIPS_ISA   (3 << 6)
 
#define STO_MICROMIPS   (2 << 6)
 
#define IS_MICROMIPS(ST_OTHER)   (((ST_OTHER)&STO_MIPS_ISA) == STO_MICROMIPS)
 

Functions

static user_id_t SegmentID (size_t PHdrIndex)
 
static uint32_t mipsVariantFromElfFlags (const elf::ELFHeader &header)
 
static uint32_t subTypeFromElfHeader (const elf::ELFHeader &header)
 
static uint32_t calc_crc32 (uint32_t crc, const void *buf, size_t size)
 
static uint32_t calc_gnu_debuglink_crc32 (const void *buf, size_t size)
 
static const char * OSABIAsCString (unsigned char osabi_byte)
 
static bool GetOsFromOSABI (unsigned char osabi_byte, llvm::Triple::OSType &ostype)
 
static SectionType GetSectionTypeFromName (llvm::StringRef Name)
 
static uint32_t GetTargetByteSize (SectionType Type, const ArchSpec &arch)
 
static Permissions GetPermissions (const ELFSectionHeader &H)
 
static Permissions GetPermissions (const ELFProgramHeader &H)
 
static char FindArmAarch64MappingSymbol (const char *symbol_name)
 
static std::pair< uint64_t, uint64_t > GetPltEntrySizeAndOffset (const ELFSectionHeader *rel_hdr, const ELFSectionHeader *plt_hdr)
 
static unsigned ParsePLTRelocations (Symtab *symbol_table, user_id_t start_id, unsigned rel_type, const ELFHeader *hdr, const ELFSectionHeader *rel_hdr, const ELFSectionHeader *plt_hdr, const ELFSectionHeader *sym_hdr, const lldb::SectionSP &plt_section_sp, DataExtractor &rel_data, DataExtractor &symtab_data, DataExtractor &strtab_data)
 

Macro Definition Documentation

◆ _MAKE_OSABI_CASE

#define _MAKE_OSABI_CASE (   x)
Value:
case x: \
return #x

Referenced by OSABIAsCString().

◆ CASE_AND_STREAM

#define CASE_AND_STREAM (   s,
  def,
  width 
)
Value:
case def: \
s->Printf("%-*s", width, #def); \
break;

Definition at line 42 of file ObjectFileELF.cpp.

Referenced by ObjectFileELF::Dump().

◆ IS_MICROMIPS

#define IS_MICROMIPS (   ST_OTHER)    (((ST_OTHER)&STO_MIPS_ISA) == STO_MICROMIPS)

Definition at line 1964 of file ObjectFileELF.cpp.

◆ NT_386_IOPERM

#define NT_386_IOPERM   0x201

Definition at line 96 of file ObjectFileELF.cpp.

◆ NT_386_TLS

#define NT_386_TLS   0x200

Definition at line 95 of file ObjectFileELF.cpp.

◆ NT_ARM_HW_BREAK

#define NT_ARM_HW_BREAK   0x402

Definition at line 111 of file ObjectFileELF.cpp.

◆ NT_ARM_HW_WATCH

#define NT_ARM_HW_WATCH   0x403

Definition at line 112 of file ObjectFileELF.cpp.

◆ NT_ARM_SYSTEM_CALL

#define NT_ARM_SYSTEM_CALL   0x404

Definition at line 113 of file ObjectFileELF.cpp.

◆ NT_ARM_TLS

#define NT_ARM_TLS   0x401

Definition at line 110 of file ObjectFileELF.cpp.

◆ NT_ARM_VFP

#define NT_ARM_VFP   0x400

Definition at line 109 of file ObjectFileELF.cpp.

◆ NT_AUXV

#define NT_AUXV   6

Definition at line 88 of file ObjectFileELF.cpp.

Referenced by ParseOpenBSDProcInfo().

◆ NT_FILE

#define NT_FILE   0x46494c45

Definition at line 90 of file ObjectFileELF.cpp.

Referenced by ObjectFileELF::GetBaseAddress(), and ParseOpenBSDProcInfo().

◆ NT_METAG_CBUF

#define NT_METAG_CBUF   0x500

Definition at line 114 of file ObjectFileELF.cpp.

◆ NT_METAG_RPIPE

#define NT_METAG_RPIPE   0x501

Definition at line 115 of file ObjectFileELF.cpp.

◆ NT_METAG_TLS

#define NT_METAG_TLS   0x502

Definition at line 116 of file ObjectFileELF.cpp.

◆ NT_PPC_SPE

#define NT_PPC_SPE   0x101

Definition at line 93 of file ObjectFileELF.cpp.

◆ NT_PPC_VMX

#define NT_PPC_VMX   0x100

Definition at line 92 of file ObjectFileELF.cpp.

◆ NT_PPC_VSX

#define NT_PPC_VSX   0x102

Definition at line 94 of file ObjectFileELF.cpp.

◆ NT_PRFPREG

#define NT_PRFPREG   2

Definition at line 85 of file ObjectFileELF.cpp.

◆ NT_PRPSINFO

#define NT_PRPSINFO   3

Definition at line 86 of file ObjectFileELF.cpp.

Referenced by ParseOpenBSDProcInfo().

◆ NT_PRSTATUS

#define NT_PRSTATUS   1

Definition at line 84 of file ObjectFileELF.cpp.

Referenced by ParseOpenBSDProcInfo().

◆ NT_PRXFPREG

#define NT_PRXFPREG   0x46e62b7f

Definition at line 91 of file ObjectFileELF.cpp.

◆ NT_S390_CTRS

#define NT_S390_CTRS   0x304

Definition at line 102 of file ObjectFileELF.cpp.

◆ NT_S390_HIGH_GPRS

#define NT_S390_HIGH_GPRS   0x300

Definition at line 98 of file ObjectFileELF.cpp.

◆ NT_S390_LAST_BREAK

#define NT_S390_LAST_BREAK   0x306

Definition at line 104 of file ObjectFileELF.cpp.

◆ NT_S390_PREFIX

#define NT_S390_PREFIX   0x305

Definition at line 103 of file ObjectFileELF.cpp.

◆ NT_S390_SYSTEM_CALL

#define NT_S390_SYSTEM_CALL   0x307

Definition at line 105 of file ObjectFileELF.cpp.

◆ NT_S390_TDB

#define NT_S390_TDB   0x308

Definition at line 106 of file ObjectFileELF.cpp.

◆ NT_S390_TIMER

#define NT_S390_TIMER   0x301

Definition at line 99 of file ObjectFileELF.cpp.

◆ NT_S390_TODCMP

#define NT_S390_TODCMP   0x302

Definition at line 100 of file ObjectFileELF.cpp.

◆ NT_S390_TODPREG

#define NT_S390_TODPREG   0x303

Definition at line 101 of file ObjectFileELF.cpp.

◆ NT_S390_VXRS_HIGH

#define NT_S390_VXRS_HIGH   0x30a

Definition at line 108 of file ObjectFileELF.cpp.

◆ NT_S390_VXRS_LOW

#define NT_S390_VXRS_LOW   0x309

Definition at line 107 of file ObjectFileELF.cpp.

◆ NT_SIGINFO

#define NT_SIGINFO   0x53494749

Definition at line 89 of file ObjectFileELF.cpp.

Referenced by ParseOpenBSDProcInfo().

◆ NT_TASKSTRUCT

#define NT_TASKSTRUCT   4

Definition at line 87 of file ObjectFileELF.cpp.

◆ NT_X86_XSTATE

#define NT_X86_XSTATE   0x202

Definition at line 97 of file ObjectFileELF.cpp.

◆ STO_MICROMIPS

#define STO_MICROMIPS   (2 << 6)

Definition at line 1963 of file ObjectFileELF.cpp.

◆ STO_MIPS_ISA

#define STO_MIPS_ISA   (3 << 6)

Definition at line 1962 of file ObjectFileELF.cpp.

Function Documentation

◆ calc_crc32()

static uint32_t calc_crc32 ( uint32_t  crc,
const void *  buf,
size_t  size 
)
static

Definition at line 438 of file ObjectFileELF.cpp.

Referenced by calc_gnu_debuglink_crc32().

◆ calc_gnu_debuglink_crc32()

static uint32_t calc_gnu_debuglink_crc32 ( const void *  buf,
size_t  size 
)
static

◆ FindArmAarch64MappingSymbol()

static char FindArmAarch64MappingSymbol ( const char *  symbol_name)
static

Definition at line 1949 of file ObjectFileELF.cpp.

◆ GetOsFromOSABI()

static bool GetOsFromOSABI ( unsigned char  osabi_byte,
llvm::Triple::OSType &  ostype 
)
static

◆ GetPermissions() [1/2]

static Permissions GetPermissions ( const ELFSectionHeader H)
static

◆ GetPermissions() [2/2]

static Permissions GetPermissions ( const ELFProgramHeader H)
static

◆ GetPltEntrySizeAndOffset()

static std::pair<uint64_t, uint64_t> GetPltEntrySizeAndOffset ( const ELFSectionHeader rel_hdr,
const ELFSectionHeader plt_hdr 
)
static

◆ GetSectionTypeFromName()

static SectionType GetSectionTypeFromName ( llvm::StringRef  Name)
static

◆ GetTargetByteSize()

static uint32_t GetTargetByteSize ( SectionType  Type,
const ArchSpec arch 
)
static

◆ mipsVariantFromElfFlags()

static uint32_t mipsVariantFromElfFlags ( const elf::ELFHeader header)
static

◆ OSABIAsCString()

static const char* OSABIAsCString ( unsigned char  osabi_byte)
static

Definition at line 520 of file ObjectFileELF.cpp.

References _MAKE_OSABI_CASE.

Referenced by ObjectFileELF::GetModuleSpecifications().

◆ ParsePLTRelocations()

static unsigned ParsePLTRelocations ( Symtab symbol_table,
user_id_t  start_id,
unsigned  rel_type,
const ELFHeader hdr,
const ELFSectionHeader rel_hdr,
const ELFSectionHeader plt_hdr,
const ELFSectionHeader sym_hdr,
const lldb::SectionSP &  plt_section_sp,
DataExtractor rel_data,
DataExtractor symtab_data,
DataExtractor strtab_data 
)
static

◆ SegmentID()

static user_id_t SegmentID ( size_t  PHdrIndex)
static

◆ subTypeFromElfHeader()

static uint32_t subTypeFromElfHeader ( const elf::ELFHeader header)
static