|
LLVM
3.7.0
|
Collects and handles dwarf debug information. More...
#include <DwarfDebug.h>
Public Member Functions | |
| DwarfDebug (AsmPrinter *A, Module *M) | |
| ~DwarfDebug () override | |
| void | beginModule () |
| Emit all Dwarf sections that should come prior to the content. More... | |
| void | endModule () override |
| Emit all Dwarf sections that should come after the content. More... | |
| void | beginFunction (const MachineFunction *MF) override |
| Gather pre-function debug information. More... | |
| void | endFunction (const MachineFunction *MF) override |
| Gather and emit post-function debug information. More... | |
| void | beginInstruction (const MachineInstr *MI) override |
| Process beginning of an instruction. More... | |
| void | endInstruction () override |
| Process end of an instruction. More... | |
| 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. More... | |
| void | addArangeLabel (SymbolCU SCU) |
| Add a label so that arange data can be generated for it. More... | |
| void | setSymbolSize (const MCSymbol *Sym, uint64_t Size) override |
| For symbols that have a size designated (e.g. More... | |
| bool | useGNUTLSOpcode () const |
| Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opcode. More... | |
| bool | useDwarfAccelTables () const |
| Returns whether or not to emit tables that dwarf consumers can use to accelerate lookup. More... | |
| bool | useSplitDwarf () const |
| Returns whether or not to change the current debug info for the split dwarf proposal support. More... | |
| unsigned | getDwarfVersion () const |
| Returns the Dwarf Version. More... | |
| const DwarfCompileUnit * | getPrevCU () const |
| Returns the previous CU that was being updated. More... | |
| void | setPrevCU (const DwarfCompileUnit *PrevCU) |
| const DebugLocStream & | getDebugLocs () const |
| Returns the entries for the .debug_loc section. More... | |
| void | emitDebugLocEntry (ByteStreamer &Streamer, const DebugLocStream::Entry &Entry) |
| Emit an entry for the debug loc section. More... | |
| void | emitDebugLocEntryLocation (const DebugLocStream::Entry &Entry) |
| Emit the location for a debug loc entry, including the size header. More... | |
| template<typename T > | |
| T * | resolve (TypedDINodeRef< T > Ref) const |
| Find the MDNode for the given reference. More... | |
| const DITypeIdentifierMap & | getTypeIdentifierMap () const |
| Return the TypeIdentifierMap. More... | |
| DwarfCompileUnit * | lookupUnit (const DIE *CU) const |
| Find the DwarfCompileUnit for the given CU Die. More... | |
| bool | isSubprogramContext (const MDNode *Context) |
| isSubprogramContext - Return true if Context is either a subprogram or another context nested inside a subprogram. More... | |
| void | addSubprogramNames (const DISubprogram *SP, DIE &Die) |
| AddressPool & | getAddressPool () |
| void | addAccelName (StringRef Name, const DIE &Die) |
| void | addAccelObjC (StringRef Name, const DIE &Die) |
| void | addAccelNamespace (StringRef Name, const DIE &Die) |
| void | addAccelType (StringRef Name, const DIE &Die, char Flags) |
| const MachineFunction * | getCurrentFunction () const |
| iterator_range < ImportedEntityMap::const_iterator > | findImportedEntitiesForScope (const MDNode *Scope) const |
| bool | isLexicalScopeDIENull (LexicalScope *Scope) |
| A helper function to check whether the DIE for a given Scope is going to be null. More... | |
| MCSymbol * | getLabelBeforeInsn (const MachineInstr *MI) |
| Return Label preceding the instruction. More... | |
| MCSymbol * | getLabelAfterInsn (const MachineInstr *MI) |
| Return Label immediately following the instruction. More... | |
| SmallPtrSet< const MDNode *, 16 > & | getProcessedSPNodes () |
Public Member Functions inherited from llvm::AsmPrinterHandler | |
| virtual | ~AsmPrinterHandler () |
| Pin vtable to this file. More... | |
| virtual void | markFunctionEnd () |
Collects and handles dwarf debug information.
Definition at line 207 of file DwarfDebug.h.
| DwarfDebug::DwarfDebug | ( | AsmPrinter * | A, |
| Module * | M | ||
| ) |
Definition at line 194 of file DwarfDebug.cpp.
References beginModule(), DbgTimerName, Default, DwarfAccelTables, DWARFGroupName, DwarfPubSections, llvm::MCTargetOptions::DwarfVersion, llvm::Module::getDwarfVersion(), llvm::MachineModuleInfo::getModule(), llvm::TargetOptions::MCOptions, llvm::TargetMachine::Options, llvm::AsmPrinter::OutStreamer, SplitDwarf, T, llvm::TimePassesIsEnabled, and llvm::AsmPrinter::TM.
|
override |
Definition at line 246 of file DwarfDebug.cpp.
Definition at line 1975 of file DwarfDebug.cpp.
References llvm::DwarfAccelTable::AddName(), llvm::DwarfStringPool::getEntry(), llvm::DwarfFile::getStringPool(), and useDwarfAccelTables().
Referenced by addSubprogramNames(), and llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE().
Definition at line 1987 of file DwarfDebug.cpp.
References llvm::DwarfAccelTable::AddName(), llvm::DwarfStringPool::getEntry(), llvm::DwarfFile::getStringPool(), and useDwarfAccelTables().
Referenced by llvm::DwarfUnit::getOrCreateNameSpace().
Definition at line 1981 of file DwarfDebug.cpp.
References llvm::DwarfAccelTable::AddName(), llvm::DwarfStringPool::getEntry(), llvm::DwarfFile::getStringPool(), and useDwarfAccelTables().
Referenced by addSubprogramNames().
Definition at line 1993 of file DwarfDebug.cpp.
References llvm::DwarfAccelTable::AddName(), llvm::DwarfStringPool::getEntry(), llvm::DwarfFile::getStringPool(), and useDwarfAccelTables().
|
inline |
Add a label so that arange data can be generated for it.
Definition at line 553 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::addLabelAddress(), llvm::DwarfCompileUnit::addLocalLabelAddress(), and llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE().
| void DwarfDebug::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.
Definition at line 1898 of file DwarfDebug.cpp.
References llvm::DwarfUnit::addDIETypeSignature(), llvm::DwarfCompileUnit::applyStmtList(), llvm::DwarfUnit::constructTypeDIE(), llvm::dwarf::DW_AT_language, llvm::dwarf::DW_FORM_data2, llvm::DwarfUnit::getLanguage(), llvm::DwarfFile::getUnits(), llvm::AddressPool::hasBeenUsed(), makeTypeSignature(), llvm::AddressPool::resetUsedFlag(), and useSplitDwarf().
Referenced by llvm::DwarfUnit::getOrCreateTypeDIE().
| void DwarfDebug::addSubprogramNames | ( | const DISubprogram * | SP, |
| DIE & | Die | ||
| ) |
Definition at line 280 of file DwarfDebug.cpp.
References addAccelName(), addAccelObjC(), llvm::Class, llvm::DIScope::getName(), getObjCClassCategory(), getObjCMethodName(), and isObjCClass().
Referenced by llvm::DwarfCompileUnit::constructInlinedScopeDIE(), and llvm::DwarfCompileUnit::updateSubprogramScopeDIE().
|
overridevirtual |
Gather pre-function debug information.
Implements llvm::AsmPrinterHandler.
Definition at line 1075 of file DwarfDebug.cpp.
References llvm::all_of(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::calculateDbgValueHistory(), llvm::DI, DWARF2_FLAG_IS_STMT, llvm::SmallVectorBase::empty(), llvm::LexicalScopes::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), findPrologueEndLoc(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::LexicalScopes::getCurrentFunctionScope(), llvm::getDISubprogram(), llvm::MachineFunction::getFunction(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::DILocalVariable::getScope(), llvm::LexicalScope::getScopeNode(), llvm::DILocalScope::getSubprogram(), llvm::MachineFunction::getSubtarget(), llvm::DINode::getTag(), llvm::DwarfUnit::getUniqueID(), llvm::MachineModuleInfo::hasDebugInfo(), I, llvm::LexicalScopes::initialize(), piecesOverlap(), and llvm::SP.
|
overridevirtual |
Process beginning of an instruction.
Implements llvm::AsmPrinterHandler.
Definition at line 957 of file DwarfDebug.cpp.
References llvm::MCContext::createTempSymbol(), llvm::DL, DWARF2_FLAG_IS_STMT, DWARF2_FLAG_PROLOGUE_END, llvm::DebugLoc::getCol(), llvm::MachineModuleInfo::getContext(), llvm::MachineInstr::getDebugLoc(), llvm::DebugLoc::getLine(), llvm::DebugLoc::getScope(), I, llvm::MachineInstr::isDebugValue(), llvm::AArch64CC::MI, and UnknownLocations.
| void DwarfDebug::beginModule | ( | ) |
Emit all Dwarf sections that should come prior to the content.
Definition at line 433 of file DwarfDebug.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), DisableDebugInfoPrinting, llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::generateDITypeIdentifierMap(), llvm::MachineModuleInfo::getModule(), llvm::Module::getNamedMetadata(), llvm::NamedMDNode::getNumOperands(), llvm::ARM_PROC::IE, llvm::makeSubprogramMap(), N, llvm::NamedMDNode::operands(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), resolve(), and llvm::MachineModuleInfo::setDebugInfoAvailability().
Referenced by DwarfDebug().
| void DwarfDebug::emitDebugLocEntry | ( | ByteStreamer & | Streamer, |
| const DebugLocStream::Entry & | Entry | ||
| ) |
Emit an entry for the debug loc section.
This can be used to handle an entry that's going to be emitted into the debug loc section.
Definition at line 1462 of file DwarfDebug.cpp.
References llvm::ByteStreamer::EmitInt8(), llvm::DebugLocStream::getBytes(), and llvm::DebugLocStream::getComments().
Referenced by emitDebugLocEntryLocation().
| void DwarfDebug::emitDebugLocEntryLocation | ( | const DebugLocStream::Entry & | Entry | ) |
Emit the location for a debug loc entry, including the size header.
Definition at line 1545 of file DwarfDebug.cpp.
References emitDebugLocEntry(), and llvm::DebugLocStream::getBytes().
|
overridevirtual |
Gather and emit post-function debug information.
Implements llvm::AsmPrinterHandler.
Definition at line 1169 of file DwarfDebug.cpp.
References llvm::LexicalScopes::empty(), llvm::LexicalScopes::getAbstractScopesList(), llvm::MachineFunction::getContext(), llvm::LexicalScopes::getCurrentFunctionScope(), llvm::MachineFunction::getFunction(), llvm::LexicalScope::getScopeNode(), llvm::DwarfFile::getScopeVariables(), llvm::MachineModuleInfo::hasDebugInfo(), llvm::DenseSet< ValueT, ValueInfoT >::insert(), llvm::DIBuilder::LineTablesOnly, and llvm::MCContext::setDwarfCompileUnitID().
|
overridevirtual |
Process end of an instruction.
Implements llvm::AsmPrinterHandler.
Definition at line 1005 of file DwarfDebug.cpp.
References llvm::MCContext::createTempSymbol(), llvm::MachineModuleInfo::getContext(), I, and llvm::MachineInstr::isDebugValue().
|
overridevirtual |
Emit all Dwarf sections that should come after the content.
Implements llvm::AsmPrinterHandler.
Definition at line 600 of file DwarfDebug.cpp.
References llvm::AddressPool::emit(), GenerateARangeSection, GenerateGnuPubSections, llvm::MachineModuleInfo::hasDebugInfo(), useDwarfAccelTables(), and useSplitDwarf().
|
inline |
Definition at line 626 of file DwarfDebug.h.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), and llvm::make_range().
Referenced by llvm::DwarfCompileUnit::constructScopeDIE().
|
inline |
Definition at line 613 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::addLabelAddress(), llvm::DwarfUnit::addOpAddress(), and llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE().
|
inline |
Definition at line 623 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::updateSubprogramScopeDIE().
|
inline |
Returns the entries for the .debug_loc section.
Definition at line 583 of file DwarfDebug.h.
Referenced by llvm::DIELocList::EmitValue().
|
inline |
Returns the Dwarf Version.
Definition at line 576 of file DwarfDebug.h.
Referenced by llvm::DwarfUnit::addBlock(), llvm::DwarfUnit::addFlag(), llvm::DwarfUnit::addLinkageName(), llvm::DwarfCompileUnit::addLocationList(), llvm::DwarfCompileUnit::addSectionDelta(), llvm::DwarfCompileUnit::addSectionLabel(), llvm::DwarfUnit::addSectionOffset(), llvm::DwarfCompileUnit::attachLowHighPC(), emitDebugLocValue(), llvm::AsmPrinter::EmitDwarfRegOp(), llvm::DwarfUnit::emitHeader(), llvm::DebugLocEntry::finalize(), llvm::DwarfUnit::getOrCreateTypeDIE(), and llvm::DIEEntry::getRefAddrSize().
| MCSymbol * DwarfDebug::getLabelAfterInsn | ( | const MachineInstr * | MI | ) |
Return Label immediately following the instruction.
Definition at line 952 of file DwarfDebug.cpp.
Referenced by llvm::DwarfCompileUnit::attachRangesOrLowHighPC(), and isLexicalScopeDIENull().
| MCSymbol * DwarfDebug::getLabelBeforeInsn | ( | const MachineInstr * | MI | ) |
Return Label preceding the instruction.
Definition at line 945 of file DwarfDebug.cpp.
References llvm::Label.
Referenced by llvm::DwarfCompileUnit::attachRangesOrLowHighPC().
|
inline |
Returns the previous CU that was being updated.
Definition at line 579 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::addRange().
|
inline |
Definition at line 645 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::constructSubprogramScopeDIE().
|
inline |
Return the TypeIdentifierMap.
Definition at line 599 of file DwarfDebug.h.
Referenced by llvm::DbgVariable::getType(), and llvm::DbgVariable::isBlockByrefVariable().
| bool DwarfDebug::isLexicalScopeDIENull | ( | LexicalScope * | Scope | ) |
A helper function to check whether the DIE for a given Scope is going to be null.
Check whether we should create a DIE for the given Scope, return true if we don't create a DIE (the corresponding DIE is null).
Definition at line 317 of file DwarfDebug.cpp.
References llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T, typename >::front(), getLabelAfterInsn(), llvm::LexicalScope::getRanges(), llvm::LexicalScope::isAbstractScope(), Ranges, and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::DwarfCompileUnit::constructLexicalScopeDIE(), and llvm::DwarfCompileUnit::constructScopeDIE().
isSubprogramContext - Return true if Context is either a subprogram or another context nested inside a subprogram.
Definition at line 305 of file DwarfDebug.cpp.
References resolve().
|
inline |
Find the DwarfCompileUnit for the given CU Die.
Definition at line 604 of file DwarfDebug.h.
Referenced by llvm::DIEEntry::EmitValue().
|
inline |
Find the MDNode for the given reference.
Definition at line 594 of file DwarfDebug.h.
References llvm::TypedDINodeRef< T >::resolve().
Referenced by beginModule(), getBaseTypeSize(), llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(), isSubprogramContext(), isUnsignedDIType(), and llvm::DwarfUnit::resolve().
|
inline |
Definition at line 580 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::addRange().
For symbols that have a size designated (e.g.
common symbols), this tracks that size.
Implements llvm::AsmPrinterHandler.
Definition at line 557 of file DwarfDebug.h.
|
inline |
Returns whether or not to emit tables that dwarf consumers can use to accelerate lookup.
Definition at line 569 of file DwarfDebug.h.
Referenced by addAccelName(), addAccelNamespace(), addAccelObjC(), addAccelType(), and endModule().
|
inline |
Returns whether to use DW_OP_GNU_push_tls_address, instead of the standard DW_OP_form_tls_address opcode.
Definition at line 563 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE().
|
inline |
Returns whether or not to change the current debug info for the split dwarf proposal support.
Definition at line 573 of file DwarfDebug.h.
Referenced by addDwarfTypeUnitType(), llvm::DwarfCompileUnit::addLabelAddress(), llvm::DwarfUnit::addOpAddress(), llvm::DIEEntry::EmitValue(), llvm::DIELocList::EmitValue(), endModule(), and llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE().
1.8.6