LLVM  6.0.0svn
Classes | Macros | Enumerations | Functions | Variables
DwarfDebug.cpp File Reference
#include "DwarfDebug.h"
#include "ByteStreamer.h"
#include "DIEHash.h"
#include "DebugLocEntry.h"
#include "DebugLocStream.h"
#include "DwarfAccelTable.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/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/TargetLoweringObjectFile.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/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 }
 
enum  LinkageNameOption { DefaultLinkageNames, AllLinkageNames, AbstractLinkageNames }
 

Functions

static bool isObjCClass (StringRef Name)
 
static bool hasObjCCategory (StringRef Name)
 
static void getObjCClassCategory (StringRef In, StringRef &Class, StringRef &Category)
 
static StringRef getObjCMethodName (StringRef In)
 
template<typename Func >
static void forBothCUs (DwarfCompileUnit &CU, Func F)
 
static SmallVectorImpl< DwarfCompileUnit::GlobalExpr > & sortGlobalExprs (SmallVectorImpl< DwarfCompileUnit::GlobalExpr > &GVEs)
 Sort and unique GVEs by comparing their fragment offset. More...
 
static DebugLocEntry::Value getDebugLocValue (const MachineInstr *MI)
 
static bool validThroughout (LexicalScopes &LScopes, const MachineInstr *DbgValue, const MachineInstr *RangeEnd)
 Determine whether a singular DBG_VALUE is valid for the entirety of its enclosing lexical scope. More...
 
static DebugLoc findPrologueEndLoc (const MachineFunction *MF)
 
static dwarf::PubIndexEntryDescriptor computeIndexValue (DwarfUnit *CU, const DIE *Die)
 computeIndexValue - Compute the gdb index value for the DIE and CU. More...
 
static void emitDebugLocValue (const AsmPrinter &AP, const DIBasicType *BT, ByteStreamer &Streamer, const DebugLocEntry::Value &Value, DwarfExpression &DwarfExpr)
 

Variables

static cl::opt< boolDisableDebugInfoPrinting ("disable-debug-info-print", cl::Hidden, cl::desc("Disable debug info printing"))
 
static cl::opt< boolUseDwarfRangesBaseAddressSpecifier ("use-dwarf-ranges-base-address-specifier", cl::Hidden, cl::desc("Use base address specifiers in debug_ranges"), cl::init(false))
 
static cl::opt< boolGenerateARangeSection ("generate-arange-section", cl::Hidden, cl::desc("Generate dwarf aranges"), cl::init(false))
 
static cl::opt< boolSplitDwarfCrossCuReferences ("split-dwarf-cross-cu-references", cl::Hidden, cl::desc("Enable cross-cu references in DWO files"), cl::init(false))
 
static cl::opt< DefaultOnOffUnknownLocations ("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< DefaultOnOffDwarfAccelTables ("dwarf-accel-tables", cl::Hidden, cl::desc("Output prototype dwarf accelerator tables."), cl::values(clEnumVal(Default, "Default for platform"), clEnumVal(Enable, "Enabled"), clEnumVal(Disable, "Disabled")), cl::init(Default))
 
static cl::opt< LinkageNameOptionDwarfLinkageNames ("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"
 
static const DwarfAccelTable::Atom TypeAtoms []
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "dwarfdebug"

Definition at line 82 of file DwarfDebug.cpp.

Enumeration Type Documentation

◆ DefaultOnOff

Enumerator
Default 
Enable 
Disable 

Definition at line 101 of file DwarfDebug.cpp.

◆ LinkageNameOption

Enumerator
DefaultLinkageNames 
AllLinkageNames 
AbstractLinkageNames 

Definition at line 118 of file DwarfDebug.cpp.

Function Documentation

◆ computeIndexValue()

static dwarf::PubIndexEntryDescriptor computeIndexValue ( DwarfUnit CU,
const DIE Die 
)
static

computeIndexValue - Compute the gdb index value for the DIE and CU.

Definition at line 1454 of file DwarfDebug.cpp.

References llvm::DebugHandlerBase::Asm, llvm::AsmPrinter::createTempSymbol(), llvm::dwarf::DW_PUBNAMES_VERSION, 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::DwarfUnit::getCUNode(), llvm::MCObjectFileInfo::getDwarfGnuPubNamesSection(), llvm::MCObjectFileInfo::getDwarfGnuPubTypesSection(), llvm::MCObjectFileInfo::getDwarfPubNamesSection(), llvm::MCObjectFileInfo::getDwarfPubTypesSection(), llvm::MCObjectFileInfo::getDwarfStrSection(), llvm::DwarfCompileUnit::getGlobalNames(), llvm::DwarfCompileUnit::getGlobalTypes(), llvm::DICompileUnit::getGnuPubnames(), llvm::DwarfCompileUnit::getLabelBegin(), llvm::DwarfUnit::getLanguage(), llvm::DwarfCompileUnit::getLength(), llvm::AsmPrinter::getObjFileLowering(), llvm::DIE::getOffset(), 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::DwarfCompileUnit::hasDwarfPubSections(), llvm::dwarf::PubIndexEntryDescriptor::Kind, llvm::dwarf::PubIndexEntryDescriptor::Linkage, llvm::AsmPrinter::OutStreamer, llvm::dwarf::PubIndexEntryDescriptor::toBits(), and llvm::DwarfDebug::useSplitDwarf().

◆ emitDebugLocValue()

static void emitDebugLocValue ( const AsmPrinter AP,
const DIBasicType BT,
ByteStreamer Streamer,
const DebugLocEntry::Value Value,
DwarfExpression DwarfExpr 
)
static

◆ findPrologueEndLoc()

static DebugLoc findPrologueEndLoc ( const MachineFunction MF)
static

Definition at line 1248 of file DwarfDebug.cpp.

References llvm::MachineInstr::FrameSetup, and MI.

Referenced by llvm::DwarfDebug::beginFunctionImpl().

◆ forBothCUs()

template<typename Func >
static void forBothCUs ( DwarfCompileUnit CU,
Func  F 
)
static

◆ getDebugLocValue()

static DebugLocEntry::Value getDebugLocValue ( const MachineInstr MI)
static

◆ getObjCClassCategory()

static void getObjCClassCategory ( StringRef  In,
StringRef Class,
StringRef Category 
)
static

◆ getObjCMethodName()

static StringRef getObjCMethodName ( StringRef  In)
static

◆ hasObjCCategory()

static bool hasObjCCategory ( StringRef  Name)
static

Definition at line 334 of file DwarfDebug.cpp.

References llvm::StringRef::find(), isObjCClass(), and llvm::StringRef::npos.

Referenced by getObjCClassCategory().

◆ isObjCClass()

static bool isObjCClass ( StringRef  Name)
static

◆ sortGlobalExprs()

◆ validThroughout()

static bool validThroughout ( LexicalScopes LScopes,
const MachineInstr DbgValue,
const MachineInstr RangeEnd 
)
static

Variable Documentation

◆ DbgTimerDescription

const char* const DbgTimerDescription = "DWARF Debug Writer"
static

Definition at line 137 of file DwarfDebug.cpp.

◆ DbgTimerName

const char* const DbgTimerName = "writer"
static

Definition at line 136 of file DwarfDebug.cpp.

◆ DisableDebugInfoPrinting

cl::opt<bool> DisableDebugInfoPrinting("disable-debug-info-print", cl::Hidden, cl::desc("Disable debug info printing"))
static

◆ DwarfAccelTables

cl::opt<DefaultOnOff> DwarfAccelTables("dwarf-accel-tables", cl::Hidden, cl::desc("Output prototype dwarf accelerator tables."), cl::values(clEnumVal(Default, "Default for platform"), clEnumVal(Enable, "Enabled"), clEnumVal(Disable, "Disabled")), cl::init(Default))
static

◆ DWARFGroupDescription

const char* const DWARFGroupDescription = "DWARF Emission"
static

Definition at line 135 of file DwarfDebug.cpp.

◆ DWARFGroupName

const char* const DWARFGroupName = "dwarf"
static

Definition at line 134 of file DwarfDebug.cpp.

◆ DwarfLinkageNames

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

◆ GenerateARangeSection

cl::opt<bool> GenerateARangeSection("generate-arange-section", cl::Hidden, cl::desc("Generate dwarf aranges"), cl::init(false))
static

◆ SplitDwarfCrossCuReferences

cl::opt<bool> SplitDwarfCrossCuReferences("split-dwarf-cross-cu-references", cl::Hidden, cl::desc("Enable cross-cu references in DWO files"), cl::init(false))
static

◆ TypeAtoms

const DwarfAccelTable::Atom TypeAtoms[]
static

◆ UnknownLocations

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

◆ UseDwarfRangesBaseAddressSpecifier

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