LLVM
8.0.1
|
#include "DwarfDebug.h"
#include "ByteStreamer.h"
#include "DIEHash.h"
#include "DebugLocEntry.h"
#include "DebugLocStream.h"
#include "DwarfCompileUnit.h"
#include "DwarfExpression.h"
#include "DwarfFile.h"
#include "DwarfUnit.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AccelTable.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/MachineLocation.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <string>
#include <utility>
#include <vector>
Go to the source code of this file.
Classes | |
struct | ArangeSpan |
Macros | |
#define | DEBUG_TYPE "dwarfdebug" |
Enumerations | |
enum | DefaultOnOff { Default, Enable, Disable, Default, Enable, Disable } |
enum | LinkageNameOption { DefaultLinkageNames, AllLinkageNames, AbstractLinkageNames } |
Variables | |
static cl::opt< bool > | DisableDebugInfoPrinting ("disable-debug-info-print", cl::Hidden, cl::desc("Disable debug info printing")) |
static cl::opt< bool > | UseDwarfRangesBaseAddressSpecifier ("use-dwarf-ranges-base-address-specifier", cl::Hidden, cl::desc("Use base address specifiers in debug_ranges"), cl::init(false)) |
static cl::opt< bool > | GenerateARangeSection ("generate-arange-section", cl::Hidden, cl::desc("Generate dwarf aranges"), cl::init(false)) |
static cl::opt< bool > | GenerateDwarfTypeUnits ("generate-type-units", cl::Hidden, cl::desc("Generate DWARF4 type units."), cl::init(false)) |
static cl::opt< bool > | SplitDwarfCrossCuReferences ("split-dwarf-cross-cu-references", cl::Hidden, cl::desc("Enable cross-cu references in DWO files"), cl::init(false)) |
static cl::opt< DefaultOnOff > | UnknownLocations ("use-unknown-locations", cl::Hidden, cl::desc("Make an absence of debug location information explicit."), cl::values(clEnumVal(Default, "At top of block or after label"), clEnumVal(Enable, "In all cases"), clEnumVal(Disable, "Never")), cl::init(Default)) |
static cl::opt< AccelTableKind > | AccelTables ("accel-tables", cl::Hidden, cl::desc("Output dwarf accelerator tables."), cl::values(clEnumValN(AccelTableKind::Default, "Default", "Default for platform"), clEnumValN(AccelTableKind::None, "Disable", "Disabled."), clEnumValN(AccelTableKind::Apple, "Apple", "Apple"), clEnumValN(AccelTableKind::Dwarf, "Dwarf", "DWARF")), cl::init(AccelTableKind::Default)) |
static cl::opt< DefaultOnOff > | DwarfInlinedStrings ("dwarf-inlined-strings", cl::Hidden, cl::desc("Use inlined strings rather than string section."), cl::values(clEnumVal(Default, "Default for platform"), clEnumVal(Enable, "Enabled"), clEnumVal(Disable, "Disabled")), cl::init(Default)) |
static cl::opt< bool > | NoDwarfRangesSection ("no-dwarf-ranges-section", cl::Hidden, cl::desc("Disable emission .debug_ranges section."), cl::init(false)) |
static cl::opt< DefaultOnOff > | DwarfSectionsAsReferences ("dwarf-sections-as-references", cl::Hidden, cl::desc("Use sections+offset as references rather than labels."), cl::values(clEnumVal(Default, "Default for platform"), clEnumVal(Enable, "Enabled"), clEnumVal(Disable, "Disabled")), cl::init(Default)) |
static cl::opt< LinkageNameOption > | DwarfLinkageNames ("dwarf-linkage-names", cl::Hidden, cl::desc("Which DWARF linkage-name attributes to emit."), cl::values(clEnumValN(DefaultLinkageNames, "Default", "Default for platform"), clEnumValN(AllLinkageNames, "All", "All"), clEnumValN(AbstractLinkageNames, "Abstract", "Abstract subprograms")), cl::init(DefaultLinkageNames)) |
static const char *const | DWARFGroupName = "dwarf" |
static const char *const | DWARFGroupDescription = "DWARF Emission" |
static const char *const | DbgTimerName = "writer" |
static const char *const | DbgTimerDescription = "DWARF Debug Writer" |
#define DEBUG_TYPE "dwarfdebug" |
Definition at line 83 of file DwarfDebug.cpp.
enum DefaultOnOff |
Enumerator | |
---|---|
Default | |
Enable | |
Disable | |
Default | |
Enable | |
Disable |
Definition at line 107 of file DwarfDebug.cpp.
enum LinkageNameOption |
Enumerator | |
---|---|
DefaultLinkageNames | |
AllLinkageNames | |
AbstractLinkageNames |
Definition at line 145 of file DwarfDebug.cpp.
|
static |
Definition at line 288 of file DwarfDebug.cpp.
References AccelTables, llvm::Apple, llvm::Default, llvm::Dwarf, llvm::Triple::isOSBinFormatMachO(), llvm::LLDB, and llvm::None.
Referenced by llvm::DwarfDebug::DwarfDebug().
|
static |
computeIndexValue - Compute the gdb index value for the DIE and CU.
Definition at line 1749 of file DwarfDebug.cpp.
References llvm::DebugHandlerBase::Asm, llvm::AsmPrinter::createTempSymbol(), llvm::dwarf::DW_PUBNAMES_VERSION, llvm::AsmPrinter::EmitDwarfOffset(), llvm::AsmPrinter::emitDwarfSymbolReference(), llvm::AsmPrinter::emitInt16(), llvm::AsmPrinter::emitInt32(), llvm::AsmPrinter::emitInt8(), llvm::AsmPrinter::EmitLabelDifference(), llvm::DwarfFile::emitStrings(), llvm::DIE::findAttribute(), llvm::dwarf::GDBIndexEntryKindString(), llvm::dwarf::GDBIndexEntryLinkageString(), llvm::MCSection::getBeginSymbol(), llvm::DwarfUnit::getCUNode(), llvm::DIEUnit::getDebugSectionOffset(), llvm::MCObjectFileInfo::getDwarfGnuPubNamesSection(), llvm::MCObjectFileInfo::getDwarfGnuPubTypesSection(), llvm::MCObjectFileInfo::getDwarfPubNamesSection(), llvm::MCObjectFileInfo::getDwarfPubTypesSection(), llvm::MCObjectFileInfo::getDwarfStrOffSection(), llvm::MCObjectFileInfo::getDwarfStrSection(), llvm::DwarfCompileUnit::getGlobalNames(), llvm::DwarfCompileUnit::getGlobalTypes(), llvm::DwarfCompileUnit::getLabelBegin(), llvm::DwarfUnit::getLanguage(), llvm::DwarfCompileUnit::getLength(), llvm::DICompileUnit::getNameTableKind(), llvm::AsmPrinter::getObjFileLowering(), llvm::DIE::getOffset(), llvm::DIEUnit::getSection(), llvm::DwarfCompileUnit::getSkeleton(), llvm::DIE::getTag(), llvm::dwarf::GIEK_FUNCTION, llvm::dwarf::GIEK_NONE, llvm::dwarf::GIEK_TYPE, llvm::dwarf::GIEK_VARIABLE, llvm::dwarf::GIEL_EXTERNAL, llvm::dwarf::GIEL_STATIC, llvm::DICompileUnit::GNU, llvm::DwarfCompileUnit::hasDwarfPubSections(), llvm::dwarf::PubIndexEntryDescriptor::Kind, llvm::dwarf::PubIndexEntryDescriptor::Linkage, Name, llvm::AsmPrinter::OutStreamer, llvm::dwarf::PubIndexEntryDescriptor::toBits(), llvm::DwarfDebug::useSectionsAsReferences(), llvm::DwarfDebug::useSegmentedStringOffsetsTable(), and llvm::DwarfDebug::useSplitDwarf().
|
static |
Definition at line 1901 of file DwarfDebug.cpp.
References llvm::DwarfExpression::addExpression(), llvm::DwarfExpression::addFragmentOffset(), llvm::DwarfExpression::addMachineRegExpression(), llvm::DwarfExpression::addSignedConstant(), llvm::DwarfExpression::addUnsignedConstant(), llvm::APFloat::bitcastToAPInt(), llvm::DebugLocEntry::Value::getConstantFP(), llvm::DIBasicType::getEncoding(), llvm::DebugLocEntry::Value::getExpression(), llvm::DebugLocEntry::Value::getInt(), llvm::DebugLocEntry::Value::getLoc(), llvm::MachineLocation::getReg(), llvm::TargetSubtargetInfo::getRegisterInfo(), llvm::MachineFunction::getSubtarget(), llvm::ConstantFP::getValueAPF(), llvm::DebugLocEntry::Value::isConstantFP(), llvm::MachineLocation::isIndirect(), llvm::DebugLocEntry::Value::isInt(), llvm::DebugLocEntry::Value::isLocation(), llvm::AsmPrinter::MF, and llvm::DwarfExpression::setMemoryLocationKind().
|
static |
Definition at line 2381 of file DwarfDebug.cpp.
References llvm::all_of(), llvm::DebugHandlerBase::Asm, assert(), llvm::dwarf::DW_MACINFO_end_file, llvm::dwarf::DW_MACINFO_start_file, llvm::AsmPrinter::emitInt8(), emitRangeList(), emitRnglistsTableHeader(), llvm::AsmPrinter::EmitULEB128(), llvm::StringRef::empty(), F(), llvm::DwarfUnit::getCUNode(), llvm::DIScope::getDirectory(), llvm::MCObjectFileInfo::getDwarfAbbrevDWOSection(), llvm::MCObjectFileInfo::getDwarfAddrSection(), llvm::MCObjectFileInfo::getDwarfInfoSection(), llvm::MCObjectFileInfo::getDwarfLineDWOSection(), llvm::MCObjectFileInfo::getDwarfMacinfoSection(), llvm::MCObjectFileInfo::getDwarfRangesSection(), llvm::MCObjectFileInfo::getDwarfRnglistsDWOSection(), llvm::MCObjectFileInfo::getDwarfRnglistsSection(), llvm::MCObjectFileInfo::getDwarfStrDWOSection(), llvm::MCObjectFileInfo::getDwarfStrOffDWOSection(), llvm::DwarfDebug::getDwarfVersion(), llvm::DIMacroFile::getElements(), llvm::DIScope::getFile(), llvm::DIMacroFile::getFile(), llvm::DIScope::getFilename(), llvm::DIMacro::getLine(), llvm::DIMacroFile::getLine(), llvm::DIMacroNode::getMacinfoType(), llvm::DwarfCompileUnit::getMacroLabelBegin(), llvm::DwarfUnit::getMD5AsBytes(), llvm::DIMacro::getName(), llvm::AsmPrinter::getObjFileLowering(), llvm::DwarfCompileUnit::getOrCreateSourceID(), llvm::DwarfFile::getRangeLists(), llvm::DwarfCompileUnit::getSkeleton(), llvm::DIScope::getSource(), llvm::DwarfCompileUnit::getUniqueID(), llvm::DIEUnit::getUnitDie(), llvm::DIMacro::getValue(), llvm::DICompileUnit::isDebugDirectivesOnly(), List, llvm_unreachable, llvm::none_of(), llvm::AsmPrinter::OutStreamer, P, llvm::DIEUnit::setSection(), llvm::DwarfDebug::useRangesSection(), llvm::DwarfDebug::useSegmentedStringOffsetsTable(), and llvm::DwarfDebug::useSplitDwarf().
|
static |
Definition at line 1969 of file DwarfDebug.cpp.
References llvm::AsmPrinter::emitInt16(), llvm::AsmPrinter::emitInt8(), llvm::AsmPrinter::EmitLabelDifference(), llvm::MCAsmInfo::getCodePointerSize(), llvm::AsmPrinter::MAI, and llvm::AsmPrinter::OutStreamer.
Referenced by emitLoclistsTableHeader(), and emitRnglistsTableHeader().
|
static |
Definition at line 2010 of file DwarfDebug.cpp.
References llvm::DebugHandlerBase::Asm, llvm::AsmPrinter::createTempSymbol(), llvm::dwarf::DW_LLE_end_of_list, llvm::dwarf::DW_LLE_offset_pair, llvm::dwarf::DW_LLE_startx_length, llvm::DwarfDebug::emitDebugLocEntryLocation(), llvm::AsmPrinter::emitInt32(), llvm::AsmPrinter::emitInt8(), llvm::AsmPrinter::EmitLabelDifference(), llvm::AsmPrinter::EmitLabelDifferenceAsULEB128(), emitListsTableHeaderStart(), llvm::AsmPrinter::EmitULEB128(), llvm::DwarfCompileUnit::getBaseAddress(), llvm::MCAsmInfo::getCodePointerSize(), llvm::MCObjectFileInfo::getDwarfLocDWOSection(), llvm::MCObjectFileInfo::getDwarfLoclistsSection(), llvm::MCObjectFileInfo::getDwarfLocSection(), llvm::DwarfDebug::getDwarfVersion(), llvm::DebugLocStream::getEntries(), llvm::AddressPool::getIndex(), llvm::DebugLocStream::getLists(), llvm::DwarfFile::getLoclistsTableBaseSym(), llvm::AsmPrinter::getObjFileLowering(), List, llvm::AsmPrinter::MAI, llvm::AsmPrinter::OutStreamer, Size, and llvm::DwarfDebug::useSplitDwarf().
|
static |
Emit a single range list. We handle both DWARF v5 and earlier.
Definition at line 2290 of file DwarfDebug.cpp.
References assert(), llvm::AsmPrinter::EmitULEB128(), llvm::DwarfDebug::getAddressPool(), llvm::DwarfCompileUnit::getBaseAddress(), llvm::MCAsmInfo::getCodePointerSize(), llvm::RangeSpanList::getCU(), llvm::DwarfUnit::getCUNode(), llvm::DwarfDebug::getDwarfVersion(), llvm::AddressPool::getIndex(), llvm::RangeSpanList::getRanges(), llvm::DICompileUnit::getRangesBaseAddress(), llvm::DwarfDebug::getSectionLabel(), llvm::RangeSpanList::getSym(), llvm::AsmPrinter::MAI, llvm::AsmPrinter::OutStreamer, P, and Size.
Referenced by emitDebugRangesImpl().
|
static |
Definition at line 1990 of file DwarfDebug.cpp.
References llvm::AsmPrinter::createTempSymbol(), llvm::AsmPrinter::emitInt32(), llvm::AsmPrinter::EmitLabelDifference(), emitListsTableHeaderStart(), llvm::DwarfFile::getRangeLists(), llvm::DwarfFile::getRnglistsTableBaseSym(), List, and llvm::AsmPrinter::OutStreamer.
Referenced by emitDebugRangesImpl().
|
static |
Definition at line 1513 of file DwarfDebug.cpp.
References llvm::MachineInstr::FrameSetup, and MI.
Referenced by llvm::DwarfDebug::beginFunctionImpl().
|
static |
Definition at line 470 of file DwarfDebug.cpp.
References F(), llvm::DwarfUnit::getCUNode(), llvm::DwarfCompileUnit::getSkeleton(), and llvm::DICompileUnit::getSplitDebugInlining().
Referenced by llvm::DwarfDebug::beginModule().
|
static |
Definition at line 1063 of file DwarfDebug.cpp.
References assert(), llvm::MachineOperand::getCImm(), llvm::MachineInstr::getDebugExpression(), llvm::MachineOperand::getFPImm(), llvm::MachineOperand::getImm(), llvm::MachineInstr::getNumOperands(), llvm::MachineInstr::getOperand(), llvm::MachineOperand::isCImm(), llvm::MachineOperand::isFPImm(), llvm::MachineOperand::isImm(), llvm::MachineOperand::isReg(), and llvm_unreachable.
Definition at line 402 of file DwarfDebug.cpp.
References llvm::StringRef::find(), hasObjCCategory(), and llvm::StringRef::slice().
Referenced by llvm::DwarfDebug::addSubprogramNames().
Definition at line 414 of file DwarfDebug.cpp.
References llvm::StringRef::find(), and llvm::StringRef::slice().
Referenced by llvm::DwarfDebug::addSubprogramNames().
Definition at line 395 of file DwarfDebug.cpp.
References llvm::StringRef::find(), isObjCClass(), and llvm::StringRef::npos.
Referenced by getObjCClassCategory().
Definition at line 391 of file DwarfDebug.cpp.
References llvm::StringRef::startswith().
Referenced by llvm::DwarfDebug::addSubprogramNames(), and hasObjCCategory().
|
static |
Sort and unique GVEs by comparing their fragment offset.
Definition at line 676 of file DwarfDebug.cpp.
References B, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::SmallVectorImpl< T >::erase(), llvm::DwarfCompileUnit::GlobalExpr::Expr, llvm::DIExpression::getFragmentInfo(), and llvm::sort().
Referenced by llvm::DwarfDebug::beginModule().
|
static |
Determine whether a singular DBG_VALUE is valid for the entirety of its enclosing lexical scope.
The check ensures there are no other instructions in the same lexical scope preceding the DBG_VALUE and that its range is either open or otherwise rolls off the end of the scope.
Definition at line 1260 of file DwarfDebug.cpp.
References llvm::DebugHandlerBase::Asm, assert(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::count(), llvm::DebugHandlerBase::DbgLabels, llvm::DebugHandlerBase::DbgValues, llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::LexicalScopes::findInlinedScope(), llvm::LexicalScopes::findLexicalScope(), llvm::MachineInstr::FrameSetup, llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::MachineInstr::getDebugLoc(), llvm::DebugHandlerBase::getLabelBeforeInsn(), llvm::MachineInstr::getOperand(), llvm::MachineInstr::getParent(), llvm::LexicalScope::getRanges(), llvm::DILocalVariable::getScope(), llvm::DILabel::getScope(), llvm::DIVariable::getType(), I, llvm::DbgVariable::initializeDbgValue(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::insert(), llvm::MachineOperand::isImm(), List, llvm::lltok::LocalVar, llvm::DebugHandlerBase::LScopes, MI, llvm::SmallVectorBase::size(), and llvm::DwarfDebug::useLocSection().
|
static |
Referenced by computeAccelTableKind().
Definition at line 164 of file DwarfDebug.cpp.
Definition at line 163 of file DwarfDebug.cpp.
|
static |
Referenced by llvm::DwarfDebug::beginModule().
Definition at line 162 of file DwarfDebug.cpp.
Definition at line 161 of file DwarfDebug.cpp.
|
static |
|
static |
Referenced by llvm::DwarfDebug::DwarfDebug().
|
static |
|
static |
Referenced by llvm::DwarfDebug::endModule().
|
static |
Referenced by llvm::DwarfDebug::DwarfDebug().
|
static |
|
static |
Referenced by llvm::DwarfDebug::shareAcrossDWOCUs().
|
static |