|
LLVM
4.0.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 | 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 | useAllLinkageNames () const |
| Returns whether we should emit all DW_AT_[MIPS_]linkage_name. 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 | useDWARF2Bitfields () const |
| Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format. More... | |
| bool | useDwarfAccelTables () const |
| Returns whether or not to emit tables that dwarf consumers can use to accelerate lookup. More... | |
| bool | useAppleExtensionAttributes () const |
| bool | useSplitDwarf () const |
| Returns whether or not to change the current debug info for the split dwarf proposal support. More... | |
| uint16_t | 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... | |
| 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 |
| bool | isLexicalScopeDIENull (LexicalScope *Scope) |
| A helper function to check whether the DIE for a given Scope is going to be null. More... | |
Public Member Functions inherited from llvm::DebugHandlerBase | |
| void | endInstruction () override |
| Process end of an instruction. More... | |
| MCSymbol * | getLabelBeforeInsn (const MachineInstr *MI) |
| Return Label preceding the instruction. More... | |
| MCSymbol * | getLabelAfterInsn (const MachineInstr *MI) |
| Return Label immediately following the instruction. More... | |
Public Member Functions inherited from llvm::AsmPrinterHandler | |
| virtual | ~AsmPrinterHandler () |
| Pin vtable to this file. More... | |
| virtual void | markFunctionEnd () |
| virtual void | beginFragment (const MachineBasicBlock *MBB, ExceptionSymbolProvider ESP) |
| virtual void | endFragment () |
| virtual void | beginFunclet (const MachineBasicBlock &MBB, MCSymbol *Sym=nullptr) |
| Emit target-specific EH funclet machinery. More... | |
| 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. More... | |
Static Public Member Functions inherited from llvm::DebugHandlerBase | |
| static int | fragmentCmp (const DIExpression *P1, const DIExpression *P2) |
| Determine the relative position of the fragments described by P1 and P2. More... | |
| static bool | fragmentsOverlap (const DIExpression *P1, const DIExpression *P2) |
| Determine whether two variable fragments overlap. More... | |
| static uint64_t | getBaseTypeSize (const DITypeRef TyRef) |
| If this type is derived from a base type then return base type size. More... | |
Additional Inherited Members | |
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. More... | |
| void | requestLabelBeforeInsn (const MachineInstr *MI) |
| Ensure that a label will be emitted before MI. More... | |
| void | requestLabelAfterInsn (const MachineInstr *MI) |
| Ensure that a label will be emitted after MI. More... | |
Protected Attributes inherited from llvm::DebugHandlerBase | |
| AsmPrinter * | Asm |
| Target of debug info emission. More... | |
| MachineModuleInfo * | MMI |
| Collected machine module information. More... | |
| DebugLoc | PrevInstLoc |
| Previous instruction's location information. More... | |
| MCSymbol * | PrevLabel = nullptr |
| const MachineBasicBlock * | PrevInstBB = nullptr |
| DebugLoc | PrologEndLoc |
| This location indicates end of function prologue and beginning of function body. More... | |
| const MachineInstr * | CurMI = nullptr |
| If nonnull, stores the current machine instruction we're processing. More... | |
| LexicalScopes | LScopes |
| DbgValueHistoryMap | DbgValues |
| History of DBG_VALUE and clobber instructions for each user variable. More... | |
| DenseMap< const MachineInstr *, MCSymbol * > | LabelsBeforeInsn |
| Maps instruction with label emitted before instruction. More... | |
| DenseMap< const MachineInstr *, MCSymbol * > | LabelsAfterInsn |
| Maps instruction with label emitted after instruction. More... | |
Collects and handles dwarf debug information.
Definition at line 196 of file DwarfDebug.h.
| DwarfDebug::DwarfDebug | ( | AsmPrinter * | A, |
| Module * | M | ||
| ) |
Definition at line 216 of file DwarfDebug.cpp.
References AllLinkageNames, llvm::DebugHandlerBase::Asm, llvm::TargetOptions::DebuggerTuning, llvm::Default, DefaultLinkageNames, llvm::dwarf::DWARF_VERSION, DwarfAccelTables, DwarfLinkageNames, DwarfPubSections, DwarfVersion(), llvm::MCTargetOptions::DwarfVersion, llvm::GDB, llvm::Module::getDwarfVersion(), llvm::MachineModuleInfo::getModule(), llvm::TargetMachine::getTargetTriple(), llvm::Triple::isPS4CPU(), llvm::LLDB, llvm::TargetOptions::MCOptions, llvm::DebugHandlerBase::MMI, llvm::TargetMachine::Options, llvm::AsmPrinter::OutStreamer, llvm::SCE, SplitDwarf, and llvm::AsmPrinter::TM.
|
override |
Definition at line 289 of file DwarfDebug.cpp.
Definition at line 2026 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 2038 of file DwarfDebug.cpp.
References llvm::DwarfAccelTable::AddName(), llvm::DwarfStringPool::getEntry(), llvm::DwarfFile::getStringPool(), and useDwarfAccelTables().
Referenced by llvm::DwarfUnit::getOrCreateNameSpace().
Definition at line 2032 of file DwarfDebug.cpp.
References llvm::DwarfAccelTable::AddName(), llvm::DwarfStringPool::getEntry(), llvm::DwarfFile::getStringPool(), and useDwarfAccelTables().
Referenced by addSubprogramNames().
Definition at line 2044 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 484 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 1950 of file DwarfDebug.cpp.
References llvm::DwarfUnit::addDIETypeSignature(), llvm::DebugHandlerBase::Asm, llvm::DIE::getUnitDie(), llvm::AddressPool::hasBeenUsed(), llvm::MipsISD::Ins, makeTypeSignature(), llvm::AddressPool::resetUsedFlag(), and useSplitDwarf().
Referenced by llvm::DwarfUnit::getOrCreateTypeDIE().
| void DwarfDebug::addSubprogramNames | ( | const DISubprogram * | SP, |
| DIE & | Die | ||
| ) |
Definition at line 322 of file DwarfDebug.cpp.
References addAccelName(), addAccelObjC(), Category, llvm::DIScope::getName(), getObjCClassCategory(), getObjCMethodName(), and isObjCClass().
Referenced by llvm::DwarfCompileUnit::constructInlinedScopeDIE(), and llvm::DwarfCompileUnit::updateSubprogramScopeDIE().
|
overridevirtual |
Gather pre-function debug information.
Reimplemented from llvm::DebugHandlerBase.
Definition at line 1140 of file DwarfDebug.cpp.
References assert(), llvm::DebugHandlerBase::beginFunction(), DWARF2_FLAG_IS_STMT, llvm::LexicalScopes::empty(), findPrologueEndLoc(), llvm::LexicalScopes::getCurrentFunctionScope(), llvm::MachineFunction::getFunction(), llvm::LexicalScope::getScopeNode(), llvm::Function::getSubprogram(), llvm::MachineModuleInfo::hasDebugInfo(), L, llvm::DebugHandlerBase::LScopes, llvm::DebugHandlerBase::MMI, llvm::DICompileUnit::NoDebug, and llvm::DebugHandlerBase::PrologEndLoc.
|
overridevirtual |
Process beginning of an instruction.
Reimplemented from llvm::DebugHandlerBase.
Definition at line 1045 of file DwarfDebug.cpp.
References assert(), llvm::DebugHandlerBase::beginInstruction(), llvm::DebugHandlerBase::CurMI, DWARF2_FLAG_IS_STMT, DWARF2_FLAG_PROLOGUE_END, fuzzer::Flags, llvm::DebugLoc::getCol(), llvm::MDNode::getContext(), llvm::MachineInstr::getDebugLoc(), llvm::DebugLoc::getLine(), llvm::MachineInstr::getParent(), llvm::DebugLoc::getScope(), llvm::MachineInstr::isCFIInstruction(), llvm::MachineInstr::isDebugValue(), llvm::DebugHandlerBase::PrevInstBB, llvm::DebugHandlerBase::PrevInstLoc, llvm::DebugHandlerBase::PrevLabel, llvm::DebugHandlerBase::PrologEndLoc, and UnknownLocations.
| void DwarfDebug::beginModule | ( | ) |
Emit all Dwarf sections that should come prior to the content.
Definition at line 501 of file DwarfDebug.cpp.
References llvm::DwarfCompileUnit::addImportedEntity(), DbgTimerDescription, DbgTimerName, llvm::Module::debug_compile_units(), llvm::Module::debug_compile_units_begin(), llvm::Module::debug_compile_units_end(), DisableDebugInfoPrinting, DWARFGroupDescription, DWARFGroupName, llvm::MachineModuleInfo::getModule(), llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(), llvm::DwarfUnit::getOrCreateTypeDIE(), llvm::Module::globals(), llvm::ARM_PROC::IE, llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::insert(), llvm::DebugHandlerBase::MMI, llvm::MachineModuleInfo::setDebugInfoAvailability(), sortGlobalExprs(), T, and llvm::TimePassesIsEnabled.
Referenced by llvm::AsmPrinter::doInitialization().
| 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 1488 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 1549 of file DwarfDebug.cpp.
References emitDebugLocEntry(), and llvm::DebugLocStream::getBytes().
|
overridevirtual |
Gather and emit post-function debug information.
Reimplemented from llvm::DebugHandlerBase.
Definition at line 1193 of file DwarfDebug.cpp.
References assert(), llvm::DebugHandlerBase::endFunction(), llvm::LexicalScopes::getAbstractScopesList(), llvm::LexicalScopes::getCurrentFunctionScope(), llvm::MachineFunction::getFunction(), llvm::LexicalScope::getScopeNode(), llvm::DwarfFile::getScopeVariables(), llvm::Function::getSubprogram(), llvm::MachineModuleInfo::hasDebugInfo(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::insert(), llvm::DICompileUnit::LineTablesOnly, llvm::DebugHandlerBase::LScopes, llvm::DebugHandlerBase::MMI, llvm::DICompileUnit::NoDebug, and llvm::DebugHandlerBase::PrevLabel.
|
overridevirtual |
Emit all Dwarf sections that should come after the content.
Implements llvm::AsmPrinterHandler.
Definition at line 660 of file DwarfDebug.cpp.
References assert(), llvm::DebugHandlerBase::CurMI, llvm::AddressPool::emit(), GenerateARangeSection, GenerateGnuPubSections, llvm::MachineModuleInfo::hasDebugInfo(), llvm::DebugHandlerBase::MMI, useDwarfAccelTables(), and useSplitDwarf().
|
inline |
Definition at line 543 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::addLabelAddress(), llvm::DwarfUnit::addOpAddress(), and llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE().
|
inline |
Definition at line 553 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::updateSubprogramScopeDIE().
|
inline |
Returns the entries for the .debug_loc section.
Definition at line 526 of file DwarfDebug.h.
Referenced by llvm::DIELocList::EmitValue().
| uint16_t DwarfDebug::getDwarfVersion | ( | ) | const |
Returns the Dwarf Version.
Definition at line 2050 of file DwarfDebug.cpp.
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(), llvm::DwarfCompileUnit::constructInlinedScopeDIE(), llvm::DwarfUnit::emitHeader(), and llvm::DwarfUnit::getOrCreateTypeDIE().
|
inline |
Returns the previous CU that was being updated.
Definition at line 522 of file DwarfDebug.h.
Referenced by llvm::DwarfCompileUnit::addRange().
| 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 347 of file DwarfDebug.cpp.
References llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::DebugHandlerBase::getLabelAfterInsn(), llvm::LexicalScope::getRanges(), llvm::LexicalScope::isAbstractScope(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::DwarfCompileUnit::constructLexicalScopeDIE(), and llvm::DwarfCompileUnit::constructScopeDIE().
|
static |
Perform an MD5 checksum of Identifier and return the lower 64 bits.
Definition at line 1939 of file DwarfDebug.cpp.
References llvm::MD5::final(), fuzzer::Hash(), llvm::support::endian::read64le(), and llvm::MD5::update().
Referenced by llvm::DwarfUnit::addDIETypeSignature(), and addDwarfTypeUnitType().
|
inline |
Find the MDNode for the given reference.
Definition at line 537 of file DwarfDebug.h.
References llvm::TypedDINodeRef< T >::resolve().
Referenced by llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE(), and isUnsignedDIType().
|
inline |
Definition at line 523 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 488 of file DwarfDebug.h.
|
inline |
Returns whether we should emit all DW_AT_[MIPS_]linkage_name.
If not, we still might emit certain cases.
Definition at line 494 of file DwarfDebug.h.
Referenced by llvm::DwarfUnit::applySubprogramDefinitionAttributes(), and llvm::DwarfCompileUnit::getOrCreateGlobalVariableDIE().
|
inline |
Definition at line 510 of file DwarfDebug.h.
Referenced by llvm::DwarfUnit::applySubprogramAttributes(), and llvm::DwarfCompileUnit::updateSubprogramScopeDIE().
|
inline |
Returns whether to use the DWARF2 format for bitfields instyead of the DWARF4 format.
Definition at line 502 of file DwarfDebug.h.
|
inline |
Returns whether or not to emit tables that dwarf consumers can use to accelerate lookup.
Definition at line 508 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 498 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 516 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