emitDebugStrDWO();
emitDebugInfoDWO();
emitDebugAbbrevDWO();
+ emitDebugLineDWO();
// Emit DWO addresses.
InfoHolder.emitAddresses(Asm->getObjFileLowering().getDwarfAddrSection());
}
NewTU->setType(NULL);
NewTU->initSection(
Asm->getObjFileLowering().getDwarfTypesSection(TU->getTypeSignature()));
- CU.applyStmtList(*Die);
initSkeletonUnit(TU, Die, NewTU);
return NewTU;
InfoHolder.emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevDWOSection());
}
+void DwarfDebug::emitDebugLineDWO() {
+ assert(useSplitDwarf() && "No split dwarf?");
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfLineDWOSection());
+ Asm->OutStreamer.EmitLabel(SplitTypeUnitFileTable.Emit(&Asm->OutStreamer).second);
+}
+
// Emit the .debug_str.dwo section for separated dwarf. This contains the
// string section and is identical in format to traditional .debug_str
// sections.
}
DIE *UnitDie = new DIE(dwarf::DW_TAG_type_unit);
- DwarfTypeUnit *NewTU = new DwarfTypeUnit(InfoHolder.getUnits().size(),
- UnitDie, CU, Asm, this, &InfoHolder);
+ DwarfTypeUnit *NewTU = new DwarfTypeUnit(
+ InfoHolder.getUnits().size(), UnitDie, CU, Asm, this, &InfoHolder,
+ useSplitDwarf() ? &SplitTypeUnitFileTable : nullptr);
TU = NewTU;
InfoHolder.addUnit(NewTU);
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MachineLocation.h"
+#include "llvm/MC/MCDwarf.h"
#include "llvm/Support/Allocator.h"
namespace llvm {
// Holder for the skeleton information.
DwarfFile SkeletonHolder;
+ // Store file names for type units under fission in a line table header that
+ // will be emitted into debug_line.dwo.
+ MCDwarfLineTableHeader SplitTypeUnitFileTable;
+
void addScopeVariable(LexicalScope *LS, DbgVariable *Var);
const SmallVectorImpl<DwarfUnit *> &getUnits() {
/// \brief Emit the debug abbrev dwo section.
void emitDebugAbbrevDWO();
+ /// \brief Emit the debug line dwo section.
+ void emitDebugLineDWO();
+
/// \brief Emit the debug str dwo section.
void emitDebugStrDWO();
}
DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU,
- AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
- : DwarfUnit(UID, D, CU.getCUNode(), A, DW, DWU), CU(CU) {}
+ AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU,
+ MCDwarfLineTableHeader *SplitLineTable)
+ : DwarfUnit(UID, D, CU.getCUNode(), A, DW, DWU), CU(CU),
+ SplitLineTable(SplitLineTable) {
+ if (SplitLineTable)
+ addSectionOffset(UnitDie.get(), dwarf::DW_AT_stmt_list, 0);
+}
/// ~Unit - Destructor for compile unit.
DwarfUnit::~DwarfUnit() {
Asm->OutStreamer.hasRawTextSupport() ? 0 : getUniqueID());
}
+unsigned DwarfTypeUnit::getOrCreateSourceID(StringRef FileName, StringRef DirName) {
+ return SplitLineTable ? SplitLineTable->getFile(DirName, FileName)
+ : getCU().getOrCreateSourceID(FileName, DirName);
+}
+
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
///
if (Line == 0)
return;
- unsigned FileID = getCU().getOrCreateSourceID(File, Directory);
+ unsigned FileID = getOrCreateSourceID(File, Directory);
assert(FileID && "Invalid file id");
addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
#include "llvm/IR/DebugInfo.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCDwarf.h"
namespace llvm {
/// getOrCreateStaticMemberDIE - Create new static data member DIE.
DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
+ /// Look up the source ID with the given directory and source file names. If
+ /// none currently exists, create a new ID and insert it in the line table.
+ virtual unsigned getOrCreateSourceID(StringRef File, StringRef Directory) = 0;
+
private:
/// constructTypeDIE - Construct basic type die from DIBasicType.
void constructTypeDIE(DIE &Buffer, DIBasicType BTy);
DwarfCompileUnit &getCU() override { return *this; }
- /// Look up the source ID with the given directory and source file names. If
- /// none currently exists, create a new ID and insert it in the line table.
- unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName);
+ unsigned getOrCreateSourceID(StringRef FileName, StringRef DirName) override;
};
class DwarfTypeUnit : public DwarfUnit {
uint64_t TypeSignature;
const DIE *Ty;
DwarfCompileUnit &CU;
+ MCDwarfLineTableHeader *SplitLineTable;
public:
DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU, AsmPrinter *A,
- DwarfDebug *DW, DwarfFile *DWU);
+ DwarfDebug *DW, DwarfFile *DWU,
+ MCDwarfLineTableHeader *SplitLineTable = nullptr);
void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
uint64_t getTypeSignature() const { return TypeSignature; }
}
void initSection(const MCSection *Section);
DwarfCompileUnit &getCU() override { return CU; }
+
+protected:
+ unsigned getOrCreateSourceID(StringRef File, StringRef Directory) override;
};
} // end llvm namespace
#endif
; FISSION-NOT: type_signature
; FISSION-LABEL: type_signature = 0x1d02f3be30cc5688
; FISSION: DW_TAG_type_unit
-; FISSION: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
-; FISSION: DW_AT_GNU_dwo_name{{.*}}"bar.dwo"
-; FISSION: DW_AT_comp_dir{{.*}}"/tmp/dbginfo"
+; FISSION-NEXT: DW_AT_GNU_dwo_name{{.*}}"bar.dwo"
+; FISSION-NEXT: DW_AT_GNU_addr_base
+; FISSION-NEXT: DW_AT_comp_dir{{.*}}"/tmp/dbginfo"
; FISSION-NOT: type_signature
; FISSION-LABEL: type_signature = 0xb04af47397402e77
; FISSION-NOT: type_signature
; CHECK-NOT: type_signature
; CHECK-LABEL: type_signature = 0xe94f6d3843e62d6b
; CHECK: DW_TAG_type_unit
-; SINGLE: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
-; FISSION-NOT: DW_AT_stmt_list
+; CHECK: DW_AT_stmt_list [DW_FORM_sec_offset] (0x00000000)
; CHECK-NOT: NULL
; CHECK-NOT: DW_AT_GNU_odr_signature
; CHECK: DW_TAG_structure_type
; CHECK-LABEL: .debug_line contents:
; CHECK: Line table prologue
; CHECK-NOT: file_names[
-; CHECK: file_names{{.*}} bar.h
+; SINGLE: file_names{{.*}} bar.h
; CHECK: file_names{{.*}} bar.cpp
; CHECK-NOT: file_names[
+
+; CHECK-LABEL: .debug_line.dwo contents:
+; FISSION: Line table prologue
+; FISSION-NOT: file_names[
+; FISSION: file_names{{.*}} bar.h
+; FISSION: file_names{{.*}} bar.cpp
+; FISSION-NOT: file_names[
+
; CHECK-LABEL: .debug_str contents:
; Use the unit size as a rough hash/identifier for the unit we're dealing with