bool hasDwarfFiles() const {
return !MCDwarfFiles.empty();
}
- bool hasDwarfLines() const {
- return !MCLineSectionOrder.empty();
- }
const std::vector<MCDwarfFile *> &getMCDwarfFiles() {
return MCDwarfFiles;
// This emits the Dwarf file and the line tables.
//
static void Emit(MCStreamer *MCOS, const MCSection *DwarfLineSection,
- MCSectionData *DLS, int PointerSize);
+ MCSectionData *DLS, int PointerSize,
+ const MCSection *TextSection = NULL);
};
class MCDwarfLineAddr {
void MCAsmStreamer::Finish() {
// Dump out the dwarf file & directory tables and line tables.
- if (getContext().hasDwarfFiles() && getContext().hasDwarfLines() && TLOF) {
+ if (getContext().hasDwarfFiles() && TLOF) {
MCDwarfFileTable::Emit(this, TLOF->getDwarfLineSection(), NULL,
- PointerSize);
+ PointerSize, TLOF->getTextSection());
}
}
void MCDwarfFileTable::Emit(MCStreamer *MCOS,
const MCSection *DwarfLineSection,
MCSectionData *DLS,
- int PointerSize) {
+ int PointerSize,
+ const MCSection *TextSection) {
// Switch to the section where the table will be emitted into.
MCOS->SwitchSection(DwarfLineSection);
delete Line;
}
+ if (TextSection && MCLineSectionOrder.begin() == MCLineSectionOrder.end()) {
+ // Emit dummy entry if line table is empty.
+
+ MCOS->SwitchSection(TextSection);
+ MCSymbol *SectionEnd = MCOS->getContext().CreateTempSymbol();
+ // Set the value of the symbol, as we are at the end of the section.
+ MCOS->EmitLabel(SectionEnd);
+
+ // Switch back the the dwarf line section.
+ MCOS->SwitchSection(DwarfLineSection);
+
+ // emit the sequence to set the address
+ EmitDwarfSetAddress(MCOS, SectionEnd, PointerSize);
+ // emit the sequence for the LineDelta (from 1) and a zero address delta.
+ MCDwarfLineAddr::Emit(MCOS, INT64_MAX, 0);
+ }
+
// This is the end of the section, so set the value of the symbol at the end
// of this section (that was used in a previous expression).
MCOS->EmitLabel(LineEndSym);