#include "llvm/DebugInfo/DWARF/DWARFVerifier.h"
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFAttribute.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFObject.h"
#include "llvm/DebugInfo/DWARF/DWARFSection.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/DJB.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include <map>
#include <set>
#include <vector>
usingnamespacellvm;
usingnamespacedwarf;
usingnamespaceobject;
namespace llvm {
class DWARFDebugInfoEntry;
}
std::optional<DWARFAddressRange>
DWARFVerifier::DieRangeInfo::insert(const DWARFAddressRange &R) { … }
DWARFVerifier::DieRangeInfo::die_range_info_iterator
DWARFVerifier::DieRangeInfo::insert(const DieRangeInfo &RI) { … }
bool DWARFVerifier::DieRangeInfo::contains(const DieRangeInfo &RHS) const { … }
bool DWARFVerifier::DieRangeInfo::intersects(const DieRangeInfo &RHS) const { … }
bool DWARFVerifier::verifyUnitHeader(const DWARFDataExtractor DebugInfoData,
uint64_t *Offset, unsigned UnitIndex,
uint8_t &UnitType, bool &isUnitDWARF64) { … }
bool DWARFVerifier::verifyName(const DWARFDie &Die) { … }
unsigned DWARFVerifier::verifyUnitContents(DWARFUnit &Unit,
ReferenceMap &UnitLocalReferences,
ReferenceMap &CrossUnitReferences) { … }
unsigned DWARFVerifier::verifyDebugInfoCallSite(const DWARFDie &Die) { … }
unsigned DWARFVerifier::verifyAbbrevSection(const DWARFDebugAbbrev *Abbrev) { … }
bool DWARFVerifier::handleDebugAbbrev() { … }
unsigned DWARFVerifier::verifyUnits(const DWARFUnitVector &Units) { … }
unsigned DWARFVerifier::verifyUnitSection(const DWARFSection &S) { … }
unsigned DWARFVerifier::verifyIndex(StringRef Name,
DWARFSectionKind InfoColumnKind,
StringRef IndexStr) { … }
bool DWARFVerifier::handleDebugCUIndex() { … }
bool DWARFVerifier::handleDebugTUIndex() { … }
bool DWARFVerifier::handleDebugInfo() { … }
unsigned DWARFVerifier::verifyDieRanges(const DWARFDie &Die,
DieRangeInfo &ParentRI) { … }
unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die,
DWARFAttribute &AttrValue) { … }
unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die,
DWARFAttribute &AttrValue,
ReferenceMap &LocalReferences,
ReferenceMap &CrossUnitReferences) { … }
unsigned DWARFVerifier::verifyDebugInfoReferences(
const ReferenceMap &References,
llvm::function_ref<DWARFUnit *(uint64_t)> GetUnitForOffset) { … }
void DWARFVerifier::verifyDebugLineStmtOffsets() { … }
void DWARFVerifier::verifyDebugLineRows() { … }
DWARFVerifier::DWARFVerifier(raw_ostream &S, DWARFContext &D,
DIDumpOptions DumpOpts)
: … { … }
bool DWARFVerifier::handleDebugLine() { … }
unsigned DWARFVerifier::verifyAppleAccelTable(const DWARFSection *AccelSection,
DataExtractor *StrData,
const char *SectionName) { … }
unsigned
DWARFVerifier::verifyDebugNamesCULists(const DWARFDebugNames &AccelTable) { … }
unsigned
DWARFVerifier::verifyNameIndexBuckets(const DWARFDebugNames::NameIndex &NI,
const DataExtractor &StrData) { … }
unsigned DWARFVerifier::verifyNameIndexAttribute(
const DWARFDebugNames::NameIndex &NI, const DWARFDebugNames::Abbrev &Abbr,
DWARFDebugNames::AttributeEncoding AttrEnc) { … }
unsigned
DWARFVerifier::verifyNameIndexAbbrevs(const DWARFDebugNames::NameIndex &NI) { … }
static SmallVector<std::string, 3> getNames(const DWARFDie &DIE,
bool IncludeStrippedTemplateNames,
bool IncludeObjCNames = true,
bool IncludeLinkageName = true) { … }
unsigned DWARFVerifier::verifyNameIndexEntries(
const DWARFDebugNames::NameIndex &NI,
const DWARFDebugNames::NameTableEntry &NTE) { … }
static bool isVariableIndexable(const DWARFDie &Die, DWARFContext &DCtx) { … }
unsigned DWARFVerifier::verifyNameIndexCompleteness(
const DWARFDie &Die, const DWARFDebugNames::NameIndex &NI) { … }
unsigned DWARFVerifier::verifyDebugNames(const DWARFSection &AccelSection,
const DataExtractor &StrData) { … }
bool DWARFVerifier::handleAccelTables() { … }
bool DWARFVerifier::handleDebugStrOffsets() { … }
bool DWARFVerifier::verifyDebugStrOffsets(
std::optional<DwarfFormat> LegacyFormat, StringRef SectionName,
const DWARFSection &Section, StringRef StrData) { … }
void OutputCategoryAggregator::Report(
StringRef s, std::function<void(void)> detailCallback) { … }
void OutputCategoryAggregator::EnumerateResults(
std::function<void(StringRef, unsigned)> handleCounts) { … }
void DWARFVerifier::summarize() { … }
raw_ostream &DWARFVerifier::error() const { … }
raw_ostream &DWARFVerifier::warn() const { … }
raw_ostream &DWARFVerifier::note() const { … }
raw_ostream &DWARFVerifier::dump(const DWARFDie &Die, unsigned indent) const { … }