#include "llvm/ADT/Triple.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
-#include "llvm/DebugInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/ValueHandle.h"
}
}
- SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FunctionBeginSym);
- SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym);
+ attachLowHighPC(SPCU, SPDie, FunctionBeginSym, FunctionEndSym);
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
MachineLocation Location(RI->getFrameRegister(*Asm->MF));
if (!GenerateGnuPubSections)
return;
- addSectionLabel(Asm, U, D, dwarf::DW_AT_GNU_pubnames,
- Asm->GetTempSymbol("gnu_pubnames", U->getUniqueID()),
- DwarfGnuPubNamesSectionSym);
-
- addSectionLabel(Asm, U, D, dwarf::DW_AT_GNU_pubtypes,
- Asm->GetTempSymbol("gnu_pubtypes", U->getUniqueID()),
- DwarfGnuPubTypesSectionSym);
+ U->addFlag(D, dwarf::DW_AT_GNU_pubnames);
}
// Create new DwarfCompileUnit for the given metadata node with tag
History.push_back(MI);
} else {
// Not a DBG_VALUE instruction.
- if (!MI->isLabel())
+ if (!MI->isPosition())
AtBlockEntry = false;
// First known non-DBG_VALUE and non-frame setup location marks
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
: Asm->getObjFileLowering().getDwarfPubNamesSection();
- DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
- const SmallVectorImpl<DwarfUnit *> &Units = Holder.getUnits();
- for (unsigned i = 0; i != Units.size(); ++i) {
- DwarfUnit *TheU = Units[i];
+ for (const auto &NU : CUMap) {
+ DwarfCompileUnit *TheU = NU.second;
+ if (auto Skeleton = static_cast<DwarfCompileUnit *>(TheU->getSkeleton()))
+ TheU = Skeleton;
unsigned ID = TheU->getUniqueID();
// Start the dwarf pubnames section.
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
: Asm->getObjFileLowering().getDwarfPubTypesSection();
- DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
- const SmallVectorImpl<DwarfUnit *> &Units = Holder.getUnits();
- for (unsigned i = 0; i != Units.size(); ++i) {
- DwarfUnit *TheU = Units[i];
+ for (const auto &NU : CUMap) {
+ DwarfCompileUnit *TheU = NU.second;
+ if (auto Skeleton = static_cast<DwarfCompileUnit *>(TheU->getSkeleton()))
+ TheU = Skeleton;
unsigned ID = TheU->getUniqueID();
// Start the dwarf pubtypes section.
unsigned char Size = Asm->getDataLayout().getPointerSize();
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_loc", 0));
unsigned index = 1;
- for (SmallVectorImpl<DotDebugLocEntry>::iterator
+ for (SmallVectorImpl<DotDebugLocEntry>::const_iterator
I = DotDebugLocEntries.begin(),
E = DotDebugLocEntries.end();
I != E; ++I, ++index) {
- DotDebugLocEntry &Entry = *I;
+ const DotDebugLocEntry &Entry = *I;
if (Entry.isMerged())
continue;
if (Entry.isEmpty()) {
CU.addDIETypeSignature(RefDie, *NewTU);
}
+
+void DwarfDebug::attachLowHighPC(DwarfCompileUnit *Unit, DIE *D,
+ MCSymbol *Begin, MCSymbol *End) {
+ Unit->addLabelAddress(D, dwarf::DW_AT_low_pc, Begin);
+ if (DwarfVersion < 4 || Triple(Asm->getTargetTriple()).isOSDarwin())
+ Unit->addLabelAddress(D, dwarf::DW_AT_high_pc, End);
+ else
+ Unit->addLabelDelta(D, dwarf::DW_AT_high_pc, End, Begin);
+}