#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFListTable.h"
#include "llvm/DebugInfo/DWARF/DWARFObject.h"
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Path.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <utility>
#include <vector>
usingnamespacellvm;
usingnamespacedwarf;
void DWARFUnitVector::addUnitsForSection(DWARFContext &C,
const DWARFSection &Section,
DWARFSectionKind SectionKind) { … }
void DWARFUnitVector::addUnitsForDWOSection(DWARFContext &C,
const DWARFSection &DWOSection,
DWARFSectionKind SectionKind,
bool Lazy) { … }
void DWARFUnitVector::addUnitsImpl(
DWARFContext &Context, const DWARFObject &Obj, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, const DWARFSection *RS,
const DWARFSection *LocSection, StringRef SS, const DWARFSection &SOS,
const DWARFSection *AOS, const DWARFSection &LS, bool LE, bool IsDWO,
bool Lazy, DWARFSectionKind SectionKind) { … }
DWARFUnit *DWARFUnitVector::addUnit(std::unique_ptr<DWARFUnit> Unit) { … }
DWARFUnit *DWARFUnitVector::getUnitForOffset(uint64_t Offset) const { … }
DWARFUnit *
DWARFUnitVector::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) { … }
DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section,
const DWARFUnitHeader &Header, const DWARFDebugAbbrev *DA,
const DWARFSection *RS, const DWARFSection *LocSection,
StringRef SS, const DWARFSection &SOS,
const DWARFSection *AOS, const DWARFSection &LS, bool LE,
bool IsDWO, const DWARFUnitVector &UnitVector)
: … { … }
DWARFUnit::~DWARFUnit() = default;
DWARFDataExtractor DWARFUnit::getDebugInfoExtractor() const { … }
std::optional<object::SectionedAddress>
DWARFUnit::getAddrOffsetSectionItem(uint32_t Index) const { … }
Expected<uint64_t> DWARFUnit::getStringOffsetSectionItem(uint32_t Index) const { … }
Error DWARFUnitHeader::extract(DWARFContext &Context,
const DWARFDataExtractor &debug_info,
uint64_t *offset_ptr,
DWARFSectionKind SectionKind) { … }
Error DWARFUnitHeader::applyIndexEntry(const DWARFUnitIndex::Entry *Entry) { … }
Error DWARFUnit::extractRangeList(uint64_t RangeListOffset,
DWARFDebugRangeList &RangeList) const { … }
void DWARFUnit::clear() { … }
const char *DWARFUnit::getCompilationDir() { … }
void DWARFUnit::extractDIEsToVector(
bool AppendCUDie, bool AppendNonCUDies,
std::vector<DWARFDebugInfoEntry> &Dies) const { … }
void DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) { … }
Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) { … }
bool DWARFUnit::parseDWO(StringRef DWOAlternativeLocation) { … }
void DWARFUnit::clearDIEs(bool KeepCUDie) { … }
Expected<DWARFAddressRangesVector>
DWARFUnit::findRnglistFromOffset(uint64_t Offset) { … }
Expected<DWARFAddressRangesVector>
DWARFUnit::findRnglistFromIndex(uint32_t Index) { … }
Expected<DWARFAddressRangesVector> DWARFUnit::collectAddressRanges() { … }
Expected<DWARFLocationExpressionsVector>
DWARFUnit::findLoclistFromOffset(uint64_t Offset) { … }
void DWARFUnit::updateAddressDieMap(DWARFDie Die) { … }
DWARFDie DWARFUnit::getSubroutineForAddress(uint64_t Address) { … }
void DWARFUnit::updateVariableDieMap(DWARFDie Die) { … }
DWARFDie DWARFUnit::getVariableForAddress(uint64_t Address) { … }
void
DWARFUnit::getInlinedChainForAddress(uint64_t Address,
SmallVectorImpl<DWARFDie> &InlinedChain) { … }
const DWARFUnitIndex &llvm::getDWARFUnitIndex(DWARFContext &Context,
DWARFSectionKind Kind) { … }
DWARFDie DWARFUnit::getParent(const DWARFDebugInfoEntry *Die) { … }
const DWARFDebugInfoEntry *
DWARFUnit::getParentEntry(const DWARFDebugInfoEntry *Die) const { … }
DWARFDie DWARFUnit::getSibling(const DWARFDebugInfoEntry *Die) { … }
const DWARFDebugInfoEntry *
DWARFUnit::getSiblingEntry(const DWARFDebugInfoEntry *Die) const { … }
DWARFDie DWARFUnit::getPreviousSibling(const DWARFDebugInfoEntry *Die) { … }
const DWARFDebugInfoEntry *
DWARFUnit::getPreviousSiblingEntry(const DWARFDebugInfoEntry *Die) const { … }
DWARFDie DWARFUnit::getFirstChild(const DWARFDebugInfoEntry *Die) { … }
const DWARFDebugInfoEntry *
DWARFUnit::getFirstChildEntry(const DWARFDebugInfoEntry *Die) const { … }
DWARFDie DWARFUnit::getLastChild(const DWARFDebugInfoEntry *Die) { … }
const DWARFDebugInfoEntry *
DWARFUnit::getLastChildEntry(const DWARFDebugInfoEntry *Die) const { … }
const DWARFAbbreviationDeclarationSet *DWARFUnit::getAbbreviations() const { … }
std::optional<object::SectionedAddress> DWARFUnit::getBaseAddress() { … }
Expected<StrOffsetsContributionDescriptor>
StrOffsetsContributionDescriptor::validateContributionSize(
DWARFDataExtractor &DA) { … }
static Expected<StrOffsetsContributionDescriptor>
parseDWARF64StringOffsetsTableHeader(DWARFDataExtractor &DA, uint64_t Offset) { … }
static Expected<StrOffsetsContributionDescriptor>
parseDWARF32StringOffsetsTableHeader(DWARFDataExtractor &DA, uint64_t Offset) { … }
static Expected<StrOffsetsContributionDescriptor>
parseDWARFStringOffsetsTableHeader(DWARFDataExtractor &DA,
llvm::dwarf::DwarfFormat Format,
uint64_t Offset) { … }
Expected<std::optional<StrOffsetsContributionDescriptor>>
DWARFUnit::determineStringOffsetsTableContribution(DWARFDataExtractor &DA) { … }
Expected<std::optional<StrOffsetsContributionDescriptor>>
DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA) { … }
std::optional<uint64_t> DWARFUnit::getRnglistOffset(uint32_t Index) { … }
std::optional<uint64_t> DWARFUnit::getLoclistOffset(uint32_t Index) { … }