class DWARFContext

Declaration

class DWARFContext : public DIContext { /* full declaration omitted */ };

Description

DWARFContext This data structure is the top level entity that deals with dwarf debug information parsing. The actual data is supplied through DWARFObj.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:47

Inherits from: DIContext

Member Variables

private llvm::DWARFUnitVector NormalUnits
private Optional<DenseMap<uint64_t, llvm::DWARFTypeUnit*>> NormalTypeUnits
private std::unique_ptr<DWARFUnitIndex> CUIndex
private std::unique_ptr<DWARFGdbIndex> GdbIndex
private std::unique_ptr<DWARFUnitIndex> TUIndex
private std::unique_ptr<DWARFDebugAbbrev> Abbrev
private std::unique_ptr<DWARFDebugLoc> Loc
private std::unique_ptr<DWARFDebugAranges> Aranges
private std::unique_ptr<DWARFDebugLine> Line
private std::unique_ptr<DWARFDebugFrame> DebugFrame
private std::unique_ptr<DWARFDebugFrame> EHFrame
private std::unique_ptr<DWARFDebugMacro> Macro
private std::unique_ptr<DWARFDebugMacro> Macinfo
private std::unique_ptr<DWARFDebugNames> Names
private std::unique_ptr<AppleAcceleratorTable> AppleNames
private std::unique_ptr<AppleAcceleratorTable> AppleTypes
private std::unique_ptr<AppleAcceleratorTable> AppleNamespaces
private std::unique_ptr<AppleAcceleratorTable> AppleObjC
private llvm::DWARFUnitVector DWOUnits
private Optional<DenseMap<uint64_t, llvm::DWARFTypeUnit*>> DWOTypeUnits
private std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO
private std::unique_ptr<DWARFDebugMacro> MacinfoDWO
private std::unique_ptr<DWARFDebugMacro> MacroDWO
private unsigned int MaxVersion = 0
The maximum DWARF version of all units.
private StringMap<std::weak_ptr<DWOFile>> DWOFiles
private std::weak_ptr<DWOFile> DWP
private bool CheckedForDWP = false
private std::string DWPName
private std::unique_ptr<MCRegisterInfo> RegInfo
private std::function<void(Error)> RecoverableErrorHandler = WithColor::defaultErrorHandler
private std::function<void(Error)> WarningHandler = WithColor::defaultWarningHandler
private std::unique_ptr<const DWARFObject> DObj

Method Overview

Inherited from DIContext:

Methods

DWARFContext(
    std::unique_ptr<const DWARFObject> DObj,
    std::string DWPName = "",
    std::function<void(Error)>
        RecoverableErrorHandler =
            WithColor::defaultErrorHandler,
    std::function<void(Error)> WarningHandler =
        WithColor::defaultWarningHandler)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:115

Parameters

std::unique_ptr<const DWARFObject> DObj
std::string DWPName = ""
std::function<void(Error)> RecoverableErrorHandler = WithColor::defaultErrorHandler
std::function<void(Error)> WarningHandler = WithColor::defaultWarningHandler

DWARFContext(llvm::DWARFContext&)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:123

Parameters

llvm::DWARFContext&

void addLocalsForDie(llvm::DWARFCompileUnit* CU,
                     llvm::DWARFDie Subprogram,
                     llvm::DWARFDie Die,
                     std::vector<DILocal>& Result)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:462

Parameters

llvm::DWARFCompileUnit* CU
llvm::DWARFDie Subprogram
llvm::DWARFDie Die
std::vector<DILocal>& Result

template <typename... Ts>
static llvm::Error checkAddressSizeSupported(
    unsigned int AddressSize,
    std::error_code EC,
    const char* Fmt,
    const Ts&... Vals)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:392

Templates

Ts

Parameters

unsigned int AddressSize
std::error_code EC
const char* Fmt
const Ts&... Vals

static bool classof(const llvm::DIContext* DICtx)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:128

Parameters

const llvm::DIContext* DICtx

void clearLineTableForUnit(llvm::DWARFUnit* U)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:338

Parameters

llvm::DWARFUnit* U

llvm::DWARFContext::compile_unit_range
compile_units()

Description

Get compile units in this context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:168

static std::unique_ptr<DWARFContext> create(
    const object::ObjectFile& Obj,
    llvm::DWARFContext::ProcessDebugRelocations
        RelocAction =
            ProcessDebugRelocations::Process,
    const llvm::LoadedObjectInfo* L = nullptr,
    std::string DWPName = "",
    std::function<void(Error)>
        RecoverableErrorHandler =
            WithColor::defaultErrorHandler,
    std::function<void(Error)> WarningHandler =
        WithColor::defaultWarningHandler)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:422

Parameters

const object::ObjectFile& Obj
llvm::DWARFContext::ProcessDebugRelocations RelocAction = ProcessDebugRelocations::Process
const llvm::LoadedObjectInfo* L = nullptr
std::string DWPName = ""
std::function<void(Error)> RecoverableErrorHandler = WithColor::defaultErrorHandler
std::function<void(Error)> WarningHandler = WithColor::defaultWarningHandler

static std::unique_ptr<DWARFContext> create(
    const StringMap<
        std::unique_ptr<MemoryBuffer>>& Sections,
    uint8_t AddrSize,
    bool isLittleEndian = sys::IsLittleEndianHost,
    std::function<void(Error)>
        RecoverableErrorHandler =
            WithColor::defaultErrorHandler,
    std::function<void(Error)> WarningHandler =
        WithColor::defaultWarningHandler)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:431

Parameters

const StringMap<std::unique_ptr<MemoryBuffer>>& Sections
uint8_t AddrSize
bool isLittleEndian = sys::IsLittleEndianHost
std::function<void(Error)> RecoverableErrorHandler = WithColor::defaultErrorHandler
std::function<void(Error)> WarningHandler = WithColor::defaultWarningHandler

void dump(llvm::raw_ostream& OS,
          llvm::DIDumpOptions DumpOpts,
          std::array<Optional<uint64_t>,
                     DIDT_ID_Count> DumpOffsets)

Description

Dump a textual representation to \p OS. If any \p DumpOffsets are present, dump only the record at the specified offset.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:134

Parameters

llvm::raw_ostream& OS
llvm::DIDumpOptions DumpOpts
std::array<Optional<uint64_t>, DIDT_ID_Count> DumpOffsets

void dump(llvm::raw_ostream& OS,
          llvm::DIDumpOptions DumpOpts)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:137

Parameters

llvm::raw_ostream& OS
llvm::DIDumpOptions DumpOpts

llvm::DWARFContext::compile_unit_range
dwo_compile_units()

Description

Get compile units in the DWO context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:201

llvm::DWARFContext::unit_iterator_range
dwo_info_section_units()

Description

Get units from .debug_info..dwo in the DWO context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:182

llvm::DWARFContext::unit_iterator_range
dwo_types_section_units()

Description

Get units from .debug_types.dwo in the DWO context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:194

llvm::DWARFContext::unit_iterator_range
dwo_units()

Description

Get all units in the DWO context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:210

const llvm::AppleAcceleratorTable& getAppleNames()

Description

Get a reference to the parsed accelerator table object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:315

const llvm::AppleAcceleratorTable&
getAppleNamespaces()

Description

Get a reference to the parsed accelerator table object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:321

const llvm::AppleAcceleratorTable& getAppleObjC()

Description

Get a reference to the parsed accelerator table object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:324

const llvm::AppleAcceleratorTable& getAppleTypes()

Description

Get a reference to the parsed accelerator table object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:318

Triple::ArchType getArch() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:447

uint8_t getCUAddrSize()

Description

Get address size from CUs. TODO: refactor compile_units() to make this const.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:445

const llvm::DWARFUnitIndex& getCUIndex()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:277

llvm::DWARFCompileUnit* getCompileUnitForAddress(
    uint64_t Address)

Description

Return the compile unit which contains instruction with provided address. TODO: change input parameter from "uint64_t Address" into "SectionedAddress Address"

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:455

Parameters

uint64_t Address

llvm::DWARFCompileUnit* getCompileUnitForOffset(
    uint64_t Offset)

Description

Return the compile unit that includes an offset (relative to .debug_info).

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:255

Parameters

uint64_t Offset

llvm::DWARFDie getDIEForOffset(uint64_t Offset)

Description

Get a DIE given an exact offset.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:258

Parameters

uint64_t Offset

llvm::DWARFContext::DIEsForAddress
getDIEsForAddress(uint64_t Address)

Description

Get the compilation unit, the function DIE and lexical block DIE for the given address where applicable. TODO: change input parameter from "uint64_t Address" into "SectionedAddress Address"

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:362

Parameters

uint64_t Address

const llvm::DWARFObject& getDWARFObj() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:126

llvm::DWARFCompileUnit* getDWOCompileUnitForHash(
    uint64_t Hash)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:251

Parameters

uint64_t Hash

std::shared_ptr<DWARFContext> getDWOContext(
    llvm::StringRef AbsolutePath)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:409

Parameters

llvm::StringRef AbsolutePath

llvm::DWARFUnit* getDWOUnitAtIndex(
    unsigned int index)

Description

Get the unit at the specified index for the DWO units.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:246

Parameters

unsigned int index

const llvm::DWARFUnitVector& getDWOUnitsVector()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:188

const llvm::DWARFDebugAbbrev* getDebugAbbrev()

Description

Get a pointer to the parsed DebugAbbrev object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:282

const llvm::DWARFDebugAbbrev* getDebugAbbrevDWO()

Description

Get a pointer to the parsed dwo abbreviations object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:288

const llvm::DWARFDebugAranges* getDebugAranges()

Description

Get a pointer to the parsed DebugAranges object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:291

Expected<const llvm::DWARFDebugFrame*>
getDebugFrame()

Description

Get a pointer to the parsed frame information object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:294

const llvm::DWARFDebugLoc* getDebugLoc()

Description

Get a pointer to the parsed DebugLoc object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:285

const llvm::DWARFDebugMacro* getDebugMacinfo()

Description

Get a pointer to the parsed DebugMacinfo information object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:300

const llvm::DWARFDebugMacro* getDebugMacinfoDWO()

Description

Get a pointer to the parsed DebugMacinfoDWO information object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:303

const llvm::DWARFDebugMacro* getDebugMacro()

Description

Get a pointer to the parsed DebugMacro information object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:306

const llvm::DWARFDebugMacro* getDebugMacroDWO()

Description

Get a pointer to the parsed DebugMacroDWO information object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:309

const llvm::DWARFDebugNames& getDebugNames()

Description

Get a reference to the parsed accelerator table object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:312

Expected<const llvm::DWARFDebugFrame*>
getEHFrame()

Description

Get a pointer to the parsed eh frame information object.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:297

llvm::DWARFGdbIndex& getGdbIndex()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:278

llvm::DIInliningInfo getInliningInfoForAddress(
    object::SectionedAddress Address,
    llvm::DILineInfoSpecifier Specifier =
        llvm::DILineInfoSpecifier())

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:372

Parameters

object::SectionedAddress Address
llvm::DILineInfoSpecifier Specifier = llvm::DILineInfoSpecifier()

llvm::DILineInfo getLineInfoForAddress(
    object::SectionedAddress Address,
    llvm::DILineInfoSpecifier Specifier =
        llvm::DILineInfoSpecifier())

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:364

Parameters

object::SectionedAddress Address
llvm::DILineInfoSpecifier Specifier = llvm::DILineInfoSpecifier()

llvm::DILineInfoTable getLineInfoForAddressRange(
    object::SectionedAddress Address,
    uint64_t Size,
    llvm::DILineInfoSpecifier Specifier =
        llvm::DILineInfoSpecifier())

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:369

Parameters

object::SectionedAddress Address
uint64_t Size
llvm::DILineInfoSpecifier Specifier = llvm::DILineInfoSpecifier()

llvm::DILineInfo getLineInfoForDataAddress(
    object::SectionedAddress Address)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:368

Parameters

object::SectionedAddress Address

llvm::DataExtractor getLineStringExtractor() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:346

const DWARFDebugLine::LineTable*
getLineTableForUnit(llvm::DWARFUnit* U)

Description

Get a pointer to a parsed line table corresponding to a compile unit. Report any parsing issues as warnings on stderr.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:328

Parameters

llvm::DWARFUnit* U

Expected<const DWARFDebugLine::LineTable*>
getLineTableForUnit(
    llvm::DWARFUnit* U,
    function_ref<void(llvm::Error)>
        RecoverableErrorHandler)

Description

Get a pointer to a parsed line table corresponding to a compile unit. Report any recoverable parsing problems using the handler.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:333

Parameters

llvm::DWARFUnit* U
function_ref<void(llvm::Error)> RecoverableErrorHandler

std::vector<DILocal> getLocalsForAddress(
    object::SectionedAddress Address)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:377

Parameters

object::SectionedAddress Address

unsigned int getMaxDWOVersion()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:266

static unsigned int getMaxSupportedVersion()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:380

unsigned int getMaxVersion()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:260

const llvm::DWARFUnitVector&
getNormalUnitsVector()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:155

unsigned int getNumCompileUnits()

Description

Get the number of compile units in this context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:216

unsigned int getNumDWOCompileUnits()

Description

Get the number of compile units in the DWO context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:228

unsigned int getNumDWOTypeUnits()

Description

Get the number of type units in the DWO context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:234

unsigned int getNumTypeUnits()

Description

Get the number of type units in this context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:222

function_ref<void(llvm::Error)>
getRecoverableErrorHandler()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:413

const llvm::MCRegisterInfo* getRegisterInfo()
    const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:411

llvm::DataExtractor getStringDWOExtractor() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:343

llvm::DataExtractor getStringExtractor() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:340

static SmallVector<uint8_t, 3>
getSupportedAddressSizes()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:385

const llvm::DWARFUnitIndex& getTUIndex()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:279

llvm::DWARFTypeUnit* getTypeUnitForHash(
    uint16_t Version,
    uint64_t Hash,
    bool IsDWO)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:252

Parameters

uint16_t Version
uint64_t Hash
bool IsDWO

llvm::DWARFUnit* getUnitAtIndex(
    unsigned int index)

Description

Get the unit at the specified index.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:240

Parameters

unsigned int index

function_ref<void(llvm::Error)>
getWarningHandler()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:417

llvm::DWARFContext::unit_iterator_range
info_section_units()

Description

Get units from .debug_info in this context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:148

static bool isAddressSizeSupported(
    unsigned int AddressSize)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:388

Parameters

unsigned int AddressSize

bool isLittleEndian() const

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:379

static bool isSupportedVersion(
    unsigned int version)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:381

Parameters

unsigned int version

llvm::Error loadRegisterInfo(
    const object::ObjectFile& Obj)

Description

Loads register info for the architecture of the provided object file. Improves readability of dumped DWARF expressions. Requires the caller to have initialized the relevant target descriptions.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:441

Parameters

const object::ObjectFile& Obj

llvm::DWARFContext::unit_iterator_range
normal_units()

Description

Get all normal compile/type units in this context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:176

void parseDWOUnits(bool Lazy = false)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:101

Parameters

bool Lazy = false

std::unique_ptr<DWARFDebugMacro>
parseMacroOrMacinfo(
    llvm::DWARFContext::MacroSecType SectionType)

Description

Parse a macro[.dwo] or macinfo[.dwo] section.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:460

Parameters

llvm::DWARFContext::MacroSecType SectionType

void parseNormalUnits()

Description

Read compile units from the debug_info section (if necessary) and type units from the debug_types sections (if necessary) and store them in NormalUnits.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:94

void setMaxVersionIfGreater(unsigned int Version)

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:272

Parameters

unsigned int Version

llvm::DWARFContext::unit_iterator_range
types_section_units()

Description

Get units from .debug_types in this context.

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:161

bool verify(llvm::raw_ostream& OS,
            llvm::DIDumpOptions DumpOpts = {})

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:142

Parameters

llvm::raw_ostream& OS
llvm::DIDumpOptions DumpOpts = {}

~DWARFContext()

Declared at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:121