LLVM: llvm::DwarfDebug Class Reference (original) (raw)

Collects and handles dwarf debug information. More...

#include "[CodeGen/AsmPrinter/DwarfDebug.h](DwarfDebug%5F8h%5Fsource.html)"

Public Types
enum class MinimizeAddrInV5 { Default, Disabled, Ranges, Expressions, Form }
enum class DWARF5AccelTableKind { CU = 0 , TU = 1 }
Public Member Functions
DwarfDebug (AsmPrinter *A)
~DwarfDebug () override
void beginModule (Module *M) override
Emit all Dwarf sections that should come prior to the content.
void endModule () override
Emit all Dwarf sections that should come after the content.
const MachineInstr * emitInitialLocDirective (const MachineFunction &MF, unsigned CUID)
Emits inital debug location directive.
void beginInstruction (const MachineInstr *MI) override
Process beginning of an instruction.
void beginCodeAlignment (const MachineBasicBlock &MBB) override
Process beginning of code alignment.
void addDwarfTypeUnitType (DwarfCompileUnit &CU, StringRef Identifier, DIE &Die, const DICompositeType *CTy)
Add a DIE to the set of types that we're going to pull into type units.
void addArangeLabel (SymbolCU SCU)
Add a label so that arange data can be generated for it.
void setSymbolSize (const MCSymbol *Sym, uint64_t Size) override
For symbols that have a size designated (e.g.
bool useAllLinkageNames () const
Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
bool useGNUTLSOpcode () const
Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opcode.
bool useDWARF2Bitfields () const
Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format.
bool useInlineStrings () const
Returns whether to use inline strings.
bool useRangesSection () const
Returns whether ranges section should be emitted.
bool alwaysUseRanges (const DwarfCompileUnit &) const
Returns whether range encodings should be used for single entry range lists.
bool useAddrOffsetExpressions () const
bool useAddrOffsetForm () const
bool useSectionsAsReferences () const
Returns whether to use sections as labels rather than temp symbols.
bool generateTypeUnits () const
Returns whether to generate DWARF v4 type units.
AccelTableKind getAccelTableKind () const
Returns what kind (if any) of accelerator tables to emit.
void setTheAccelTableKind (AccelTableKind K)
Seet TheAccelTableKind.
bool useAppleExtensionAttributes () const
bool useSplitDwarf () const
Returns whether or not to change the current debug info for the split dwarf proposal support.
bool useSegmentedStringOffsetsTable () const
Returns whether to generate a string offsets table with (possibly shared) contributions from each CU and type unit.
bool emitDebugEntryValues () const
bool useOpConvert () const
bool shareAcrossDWOCUs () const
uint16_t getDwarfVersion () const
Returns the Dwarf Version.
dwarf::Form getDwarfSectionOffsetForm () const
Returns a suitable DWARF form to represent a section offset, i.e.
const DwarfCompileUnit * getPrevCU () const
Returns the previous CU that was being updated.
void setPrevCU (const DwarfCompileUnit *PrevCU)
void terminateLineTable (const DwarfCompileUnit *CU)
Terminate the line table by adding the last range label.
const DebugLocStream & getDebugLocs () const
Returns the entries for the .debug_loc section.
void emitDebugLocEntry (ByteStreamer &Streamer, const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU)
Emit an entry for the debug loc section.
void emitDebugLocEntryLocation (const DebugLocStream::Entry &Entry, const DwarfCompileUnit *CU)
Emit the location for a debug loc entry, including the size header.
void addSubprogramNames (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, const DISubprogram *SP, DIE &Die)
AddressPool & getAddressPool ()
void addAccelName (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
void addAccelObjC (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
void addAccelNamespace (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die)
void addAccelType (const DwarfUnit &Unit, const DICompileUnit::DebugNameTableKind NameTableKind, StringRef Name, const DIE &Die, char Flags)
const MachineFunction * getCurrentFunction () const
bool isLexicalScopeDIENull (LexicalScope *Scope)
A helper function to check whether the DIE for a given Scope is going to be null.
DwarfCompileUnit * lookupCU (const DIE *Die)
Find the matching DwarfCompileUnit for the given CU DIE.
const DwarfCompileUnit * lookupCU (const DIE *Die) const
DwarfCompileUnit & getOrCreateAbstractSubprogramCU (const DISubprogram *SP, DwarfCompileUnit &SrcCU)
Find the matching DwarfCompileUnit for the given SP referenced from SrcCU.
unsigned getStringTypeLoc (const DIStringType *ST) const
void addStringTypeLoc (const DIStringType *ST, unsigned Loc)
bool tuneForGDB () const
bool tuneForLLDB () const
bool tuneForSCE () const
bool tuneForDBX () const
const MCSymbol * getSectionLabel (const MCSection *S)
void insertSectionLabel (const MCSymbol *S)
std::optional< MD5::MD5Result > getMD5AsBytes (const DIFile *File) const
If the File has an MD5 checksum, return it as an MD5Result allocated in the MCContext.
MDNodeSet & getLocalDeclsForScope (const DILocalScope *S)
void setCurrentDWARF5AccelTable (const DWARF5AccelTableKind Kind)
Sets the current DWARF5AccelTable to use.
DWARF5AccelTable & getCurrentDWARF5AccelTable ()
Returns either CU or TU DWARF5AccelTable.
Public Member Functions inherited from llvm::DebugHandlerBase
~DebugHandlerBase () override
void endInstruction () override
Process end of an instruction.
void beginFunction (const MachineFunction *MF) override
Gather pre-function debug information.
void endFunction (const MachineFunction *MF) override
Gather post-function debug information.
void beginBasicBlockSection (const MachineBasicBlock &MBB) override
Process the beginning of a new basic-block-section within a function.
void endBasicBlockSection (const MachineBasicBlock &MBB) override
Process the end of a basic-block-section within a function.
MCSymbol * getLabelBeforeInsn (const MachineInstr *MI)
Return Label preceding the instruction.
MCSymbol * getLabelAfterInsn (const MachineInstr *MI)
Return Label immediately following the instruction.
const InstructionOrdering & getInstOrdering () const
const LexicalScopes & getLexicalScopes () const
Public Member Functions inherited from llvm::AsmPrinterHandler
virtual ~AsmPrinterHandler ()
Pin vtables to this file.
virtual void markFunctionEnd ()
virtual void beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr)
Emit target-specific EH funclet machinery.
virtual void endFunclet ()
Static Public Member Functions
static uint64_t makeTypeSignature (StringRef Identifier)
Perform an MD5 checksum of Identifier and return the lower 64 bits.
static void emitDebugLocValue (const AsmPrinter &AP, const DIBasicType *BT, const DbgValueLoc &Value, DwarfExpression &DwarfExpr)
Static Public Member Functions inherited from llvm::DebugHandlerBase
static uint64_t getBaseTypeSize (const DIType *Ty)
If this type is derived from a base type then return base type size.
static bool isUnsignedDIType (const DIType *Ty)
Return true if type encoding is unsigned.
Protected Member Functions
void beginFunctionImpl (const MachineFunction *MF) override
Gather pre-function debug information.
void endFunctionImpl (const MachineFunction *MF) override
Gather and emit post-function debug information.
unsigned getDwarfCompileUnitIDForLineTable (const DwarfCompileUnit &CU)
Get Dwarf compile unit ID for line table.
void skippedNonDebugFunction () override
Protected Member Functions inherited from llvm::DebugHandlerBase
DebugHandlerBase (AsmPrinter *A)
void identifyScopeMarkers ()
Indentify instructions that are marking the beginning of or ending of a scope.
void requestLabelBeforeInsn (const MachineInstr *MI)
Ensure that a label will be emitted before MI.
void requestLabelAfterInsn (const MachineInstr *MI)
Ensure that a label will be emitted after MI.
Additional Inherited Members
Protected Attributes inherited from llvm::DebugHandlerBase
AsmPrinter * Asm = nullptr
Target of debug info emission.
MachineModuleInfo * MMI = nullptr
Collected machine module information.
DebugLoc PrevInstLoc
Previous instruction's location information.
MCSymbol * PrevLabel = nullptr
const MachineBasicBlock * PrevInstBB = nullptr
const MachineInstr * PrologEndLoc
This location indicates end of function prologue and beginning of function body.
const MachineBasicBlock * EpilogBeginBlock = nullptr
This block includes epilogue instructions.
const MachineInstr * CurMI = nullptr
If nonnull, stores the current machine instruction we're processing.
LexicalScopes LScopes
DbgValueHistoryMap DbgValues
History of DBG_VALUE and clobber instructions for each user variable.
DbgLabelInstrMap DbgLabels
Mapping of inlined labels and DBG_LABEL machine instruction.
DenseMap< const MachineInstr *, MCSymbol * > LabelsBeforeInsn
Maps instruction with label emitted before instruction.
DenseMap< const MachineInstr *, MCSymbol * > LabelsAfterInsn
Maps instruction with label emitted after instruction.

Collects and handles dwarf debug information.

Definition at line 351 of file DwarfDebug.h.

DWARF5AccelTableKind

MinimizeAddrInV5

Enumerator
Default
Disabled
Ranges
Expressions
Form

Definition at line 453 of file DwarfDebug.h.

Definition at line 334 of file DwarfDebug.cpp.

References A(), AllLinkageNames, llvm::DebugHandlerBase::Asm, computeAccelTableKind(), llvm::DBX, llvm::DebugHandlerBase::DebugHandlerBase(), llvm::Default, Default, DefaultLinkageNames, llvm::dwarf::DWARF32, llvm::dwarf::DWARF64, llvm::dwarf::DWARF_VERSION, DwarfInlinedStrings, DwarfLinkageNames, DwarfOpConvert, DwarfSectionsAsReferences, llvm::Enable, llvm::GDB, GenerateARangeSection, GenerateDwarfTypeUnits, if(), llvm::LLDB, MinimizeAddrInV5Option, llvm::DebugHandlerBase::MMI, NoDwarfRangesSection, llvm::report_fatal_error(), llvm::SCE, tuneForDBX(), tuneForGDB(), tuneForLLDB(), tuneForSCE(), UseGNUDebugMacro, and useSplitDwarf().

~DwarfDebug()

DwarfDebug::~DwarfDebug ( ) overridedefault

References MBB, and MI.

addAccelName()

addAccelNamespace()

addAccelObjC()

addAccelType()

addArangeLabel()

void llvm::DwarfDebug::addArangeLabel ( SymbolCU SCU) inline

addDwarfTypeUnitType()

Add a DIE to the set of types that we're going to pull into type units.

Definition at line 3952 of file DwarfDebug.cpp.

References llvm::DwarfUnit::addString(), llvm::DwarfUnit::addStringOffsetsStart(), llvm::DwarfUnit::addUInt(), llvm::DebugHandlerBase::Asm, llvm::cast(), llvm::DwarfUnit::createTypeDIE(), CU, llvm::Dwarf, getAccelTableKind(), getDwarfVersion(), llvm::DIType::getScope(), llvm::DIEUnit::getUnitDie(), makeTypeSignature(), setCurrentDWARF5AccelTable(), llvm::DIEUnit::setSection(), llvm::DwarfTypeUnit::setType(), llvm::DwarfTypeUnit::setTypeSignature(), TU, useSegmentedStringOffsetsTable(), and useSplitDwarf().

addStringTypeLoc()

addSubprogramNames()

Definition at line 481 of file DwarfDebug.cpp.

References addAccelName(), addAccelObjC(), llvm::Apple, llvm::DICompileUnit::Apple, llvm::GlobalValue::dropLLVMManglingEscape(), getAccelTableKind(), getObjCClassCategory(), getObjCMethodName(), isObjCClass(), llvm::LinkageName, llvm::DICompileUnit::None, and useAllLinkageNames().

alwaysUseRanges()

beginCodeAlignment()

beginFunctionImpl()

beginInstruction()

Process beginning of an instruction.

Reimplemented from llvm::DebugHandlerBase.

Definition at line 2021 of file DwarfDebug.cpp.

References llvm::MachineInstr::AnyInBundle, llvm::DebugHandlerBase::Asm, assert(), llvm::DebugHandlerBase::beginInstruction(), llvm::DebugHandlerBase::CurMI, llvm::Disable, DL, DWARF2_FLAG_EPILOGUE_BEGIN, DWARF2_FLAG_IS_STMT, DWARF2_FLAG_PROLOGUE_END, llvm::Enable, llvm::DebugHandlerBase::EpilogBeginBlock, llvm::MachineInstr::FrameDestroy, llvm::MachineInstr::FrameSetup, llvm::MachineFunction::getFunction(), llvm::TargetSubtargetInfo::getInstrInfo(), llvm::Function::getSubprogram(), llvm::MachineFunction::getSubtarget(), KeyInstructionsAreStmts, MBB, MI, llvm::DICompileUnit::NoDebug, llvm::DebugHandlerBase::PrevInstBB, llvm::DebugHandlerBase::PrevInstLoc, llvm::DebugHandlerBase::PrevLabel, llvm::DebugHandlerBase::PrologEndLoc, llvm::DebugHandlerBase::requestLabelAfterInsn(), llvm::DebugHandlerBase::requestLabelBeforeInsn(), TII, and UnknownLocations.

beginModule()

void DwarfDebug::beginModule ( Module * M) overridevirtual

Emit all Dwarf sections that should come prior to the content.

Reimplemented from llvm::DebugHandlerBase.

Definition at line 1175 of file DwarfDebug.cpp.

References llvm::DebugHandlerBase::Asm, assert(), llvm::DebugHandlerBase::beginModule(), llvm::cast(), llvm::dyn_cast(), getDwarfVersion(), llvm::Global, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::DwarfFile::setRnglistsTableBaseSym(), sortGlobalExprs(), useSegmentedStringOffsetsTable(), and useSplitDwarf().

emitDebugEntryValues()

bool llvm::DwarfDebug::emitDebugEntryValues ( ) const inline

emitDebugLocEntry()

emitDebugLocEntryLocation()

emitDebugLocValue()

Definition at line 3125 of file DwarfDebug.cpp.

References llvm::DwarfExpression::addBooleanConstant(), llvm::DwarfExpression::addConstantFP(), llvm::DwarfExpression::addExpression(), llvm::DwarfExpression::addFragmentOffset(), llvm::DwarfExpression::addMachineRegExpression(), llvm::DwarfExpression::addSignedConstant(), llvm::DwarfExpression::addUnsignedConstant(), llvm::DwarfExpression::addWasmLocation(), llvm::any_of(), assert(), llvm::DwarfExpression::beginEntryValueExpression(), llvm::dbgs(), llvm::AsmPrinter::getDwarfDebug(), llvm::AsmPrinter::getDwarfVersion(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::TargetMachine::getTargetTriple(), llvm::Triple::isWasm(), LLVM_DEBUG, llvm::AsmPrinter::MF, llvm::DwarfExpression::setLocation(), llvm::DwarfExpression::setMemoryLocationKind(), llvm::AsmPrinter::TM, TRI, and tuneForSCE().

Referenced by llvm::DwarfCompileUnit::constructCallSiteParmEntryDIEs(), and llvm::DebugLocEntry::finalize().

emitInitialLocDirective()

endFunctionImpl()

Gather and emit post-function debug information.

Implements llvm::DebugHandlerBase.

Definition at line 2753 of file DwarfDebug.cpp.

References addArangeLabel(), llvm::DwarfCompileUnit::addRange(), llvm::DebugHandlerBase::Asm, assert(), llvm::cast(), llvm::DwarfCompileUnit::constructSubprogramScopeDIE(), llvm::DwarfCompileUnit::createAbstractEntity(), F, llvm::DwarfUnit::getCUNode(), llvm::DICompileUnit::getDebugInfoForProfiling(), llvm::DICompileUnit::getEmissionKind(), llvm::DwarfCompileUnit::getExistingAbstractEntity(), llvm::MachineFunction::getFunction(), getRetainedNodeScope(), llvm::LexicalScope::getScopeNode(), llvm::DwarfCompileUnit::getSkeleton(), llvm::DICompileUnit::getSplitDebugInlining(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert(), llvm::isa(), llvm::DICompileUnit::isDebugDirectivesOnly(), llvm::DICompileUnit::LineTablesOnly, llvm::DebugHandlerBase::LScopes, and llvm::DebugHandlerBase::PrevLabel.

endModule()

void DwarfDebug::endModule ( ) overridevirtual

Emit all Dwarf sections that should come after the content.

Implements llvm::AsmPrinterHandler.

Definition at line 1436 of file DwarfDebug.cpp.

References llvm::Apple, llvm::DebugHandlerBase::Asm, assert(), llvm::cast(), llvm::DebugHandlerBase::CurMI, D(), llvm::Default, llvm::Dwarf, llvm::dyn_cast(), getAccelTableKind(), llvm::isa_and_nonnull(), llvm_unreachable, llvm::None, P, terminateLineTable(), and useSplitDwarf().

generateTypeUnits()

bool llvm::DwarfDebug::generateTypeUnits ( ) const inline

Returns whether to generate DWARF v4 type units.

Definition at line 808 of file DwarfDebug.h.

getAccelTableKind()

getAddressPool()

AddressPool & llvm::DwarfDebug::getAddressPool ( ) inline

getCurrentDWARF5AccelTable()

getCurrentFunction()

getDebugLocs()

getDwarfCompileUnitIDForLineTable()

getDwarfSectionOffsetForm()

dwarf::Form DwarfDebug::getDwarfSectionOffsetForm ( ) const

Returns a suitable DWARF form to represent a section offset, i.e.

Definition at line 4144 of file DwarfDebug.cpp.

References llvm::DebugHandlerBase::Asm, and assert().

getDwarfVersion()

uint16_t DwarfDebug::getDwarfVersion ( ) const

getLocalDeclsForScope()

getMD5AsBytes()

getOrCreateAbstractSubprogramCU()

getPrevCU()

Returns the previous CU that was being updated.

Definition at line 856 of file DwarfDebug.h.

getSectionLabel()

getStringTypeLoc()

insertSectionLabel()

isLexicalScopeDIENull()

lookupCU() [1/2]

lookupCU() [2/2]

makeTypeSignature()

setCurrentDWARF5AccelTable()

void llvm::DwarfDebug::setCurrentDWARF5AccelTable ( const DWARF5AccelTableKind Kind) inline

setPrevCU()

setSymbolSize()

setTheAccelTableKind()

void llvm::DwarfDebug::setTheAccelTableKind ( AccelTableKind K) inline

shareAcrossDWOCUs()

bool DwarfDebug::shareAcrossDWOCUs ( ) const

skippedNonDebugFunction()

void DwarfDebug::skippedNonDebugFunction ( ) overrideprotectedvirtual

terminateLineTable()

useAddrOffsetExpressions()

bool llvm::DwarfDebug::useAddrOffsetExpressions ( ) const inline

useAddrOffsetForm()

bool llvm::DwarfDebug::useAddrOffsetForm ( ) const inline

useAllLinkageNames()

bool llvm::DwarfDebug::useAllLinkageNames ( ) const inline

Returns whether we should emit all DW_AT_[MIPS_]linkage_name.

If not, we still might emit certain cases.

Definition at line 770 of file DwarfDebug.h.

Referenced by addSubprogramNames().

useAppleExtensionAttributes()

bool llvm::DwarfDebug::useAppleExtensionAttributes ( ) const inline

useDWARF2Bitfields()

bool llvm::DwarfDebug::useDWARF2Bitfields ( ) const inline

Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format.

Definition at line 778 of file DwarfDebug.h.

useGNUTLSOpcode()

bool llvm::DwarfDebug::useGNUTLSOpcode ( ) const inline

Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opcode.

Definition at line 774 of file DwarfDebug.h.

useInlineStrings()

bool llvm::DwarfDebug::useInlineStrings ( ) const inline

Returns whether to use inline strings.

Definition at line 781 of file DwarfDebug.h.

useOpConvert()

bool llvm::DwarfDebug::useOpConvert ( ) const inline

useRangesSection()

bool llvm::DwarfDebug::useRangesSection ( ) const inline

Returns whether ranges section should be emitted.

Definition at line 784 of file DwarfDebug.h.

useSectionsAsReferences()

bool llvm::DwarfDebug::useSectionsAsReferences ( ) const inline

Returns whether to use sections as labels rather than temp symbols.

Definition at line 803 of file DwarfDebug.h.

useSegmentedStringOffsetsTable()

bool llvm::DwarfDebug::useSegmentedStringOffsetsTable ( ) const inline

Returns whether to generate a string offsets table with (possibly shared) contributions from each CU and type unit.

This implies the use of DW_FORM_strx* indirect references with DWARF v5 and beyond. Note that DW_FORM_GNU_str_index is also an indirect reference, but it is used with a pre-DWARF v5 implementation of split DWARF sections, which uses a monolithic string offsets table.

Definition at line 832 of file DwarfDebug.h.

Referenced by addDwarfTypeUnitType(), and beginModule().

useSplitDwarf()

bool llvm::DwarfDebug::useSplitDwarf ( ) const inline

The documentation for this class was generated from the following files: