forked from OSchip/llvm-project
DebugInfo: Move loclist base address from DwarfFile to DebugLocStream
There's no need to have more than one of these (there can be two DwarfFiles - one for the .o, one for the .dwo - but only one loc/loclist section (either in the .o or the .dwo) & certainly one per DebugLocStream, which is currently singular in DwarfDebug) llvm-svn: 375183
This commit is contained in:
parent
03819d1c80
commit
2941cda5be
|
@ -49,6 +49,7 @@ private:
|
||||||
SmallVector<Entry, 32> Entries;
|
SmallVector<Entry, 32> Entries;
|
||||||
SmallString<256> DWARFBytes;
|
SmallString<256> DWARFBytes;
|
||||||
std::vector<std::string> Comments;
|
std::vector<std::string> Comments;
|
||||||
|
MCSymbol *Sym;
|
||||||
|
|
||||||
/// Only verbose textual output needs comments. This will be set to
|
/// Only verbose textual output needs comments. This will be set to
|
||||||
/// true for that case, and false otherwise.
|
/// true for that case, and false otherwise.
|
||||||
|
@ -59,6 +60,12 @@ public:
|
||||||
size_t getNumLists() const { return Lists.size(); }
|
size_t getNumLists() const { return Lists.size(); }
|
||||||
const List &getList(size_t LI) const { return Lists[LI]; }
|
const List &getList(size_t LI) const { return Lists[LI]; }
|
||||||
ArrayRef<List> getLists() const { return Lists; }
|
ArrayRef<List> getLists() const { return Lists; }
|
||||||
|
MCSymbol *getSym() const {
|
||||||
|
return Sym;
|
||||||
|
}
|
||||||
|
void setSym(MCSymbol *Sym) {
|
||||||
|
this->Sym = Sym;
|
||||||
|
}
|
||||||
|
|
||||||
class ListBuilder;
|
class ListBuilder;
|
||||||
class EntryBuilder;
|
class EntryBuilder;
|
||||||
|
|
|
@ -965,8 +965,6 @@ void DwarfDebug::beginModule() {
|
||||||
DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
|
DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
|
||||||
Holder.setRnglistsTableBaseSym(
|
Holder.setRnglistsTableBaseSym(
|
||||||
Asm->createTempSymbol("rnglists_table_base"));
|
Asm->createTempSymbol("rnglists_table_base"));
|
||||||
Holder.setLoclistsTableBaseSym(
|
|
||||||
Asm->createTempSymbol("loclists_table_base"));
|
|
||||||
|
|
||||||
if (useSplitDwarf())
|
if (useSplitDwarf())
|
||||||
InfoHolder.setRnglistsTableBaseSym(
|
InfoHolder.setRnglistsTableBaseSym(
|
||||||
|
@ -1138,8 +1136,12 @@ void DwarfDebug::finalizeModuleInfo() {
|
||||||
if (U.hasRangeLists())
|
if (U.hasRangeLists())
|
||||||
U.addRnglistsBase();
|
U.addRnglistsBase();
|
||||||
|
|
||||||
if (!DebugLocs.getLists().empty() && !useSplitDwarf())
|
if (!DebugLocs.getLists().empty() && !useSplitDwarf()) {
|
||||||
U.addLoclistsBase();
|
DebugLocs.setSym(Asm->createTempSymbol("loclists_table_base"));
|
||||||
|
U.addSectionLabel(U.getUnitDie(), dwarf::DW_AT_loclists_base,
|
||||||
|
DebugLocs.getSym(),
|
||||||
|
TLOF.getDwarfLoclistsSection()->getBeginSymbol());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *CUNode = cast<DICompileUnit>(P.first);
|
auto *CUNode = cast<DICompileUnit>(P.first);
|
||||||
|
@ -2304,16 +2306,18 @@ static MCSymbol *emitRnglistsTableHeader(AsmPrinter *Asm,
|
||||||
// designates the end of the table for the caller to emit when the table is
|
// designates the end of the table for the caller to emit when the table is
|
||||||
// complete.
|
// complete.
|
||||||
static MCSymbol *emitLoclistsTableHeader(AsmPrinter *Asm,
|
static MCSymbol *emitLoclistsTableHeader(AsmPrinter *Asm,
|
||||||
const DwarfFile &Holder) {
|
const DwarfDebug &DD) {
|
||||||
MCSymbol *TableStart = Asm->createTempSymbol("debug_loclist_table_start");
|
MCSymbol *TableStart = Asm->createTempSymbol("debug_loclist_table_start");
|
||||||
MCSymbol *TableEnd = Asm->createTempSymbol("debug_loclist_table_end");
|
MCSymbol *TableEnd = Asm->createTempSymbol("debug_loclist_table_end");
|
||||||
emitListsTableHeaderStart(Asm, TableStart, TableEnd);
|
emitListsTableHeaderStart(Asm, TableStart, TableEnd);
|
||||||
|
|
||||||
|
const auto &DebugLocs = DD.getDebugLocs();
|
||||||
|
|
||||||
// FIXME: Generate the offsets table and use DW_FORM_loclistx with the
|
// FIXME: Generate the offsets table and use DW_FORM_loclistx with the
|
||||||
// DW_AT_loclists_base attribute. Until then set the number of offsets to 0.
|
// DW_AT_loclists_base attribute. Until then set the number of offsets to 0.
|
||||||
Asm->OutStreamer->AddComment("Offset entry count");
|
Asm->OutStreamer->AddComment("Offset entry count");
|
||||||
Asm->emitInt32(0);
|
Asm->emitInt32(0);
|
||||||
Asm->OutStreamer->EmitLabel(Holder.getLoclistsTableBaseSym());
|
Asm->OutStreamer->EmitLabel(DebugLocs.getSym());
|
||||||
|
|
||||||
return TableEnd;
|
return TableEnd;
|
||||||
}
|
}
|
||||||
|
@ -2435,8 +2439,7 @@ void DwarfDebug::emitDebugLoc() {
|
||||||
if (getDwarfVersion() >= 5) {
|
if (getDwarfVersion() >= 5) {
|
||||||
Asm->OutStreamer->SwitchSection(
|
Asm->OutStreamer->SwitchSection(
|
||||||
Asm->getObjFileLowering().getDwarfLoclistsSection());
|
Asm->getObjFileLowering().getDwarfLoclistsSection());
|
||||||
TableEnd = emitLoclistsTableHeader(Asm, useSplitDwarf() ? SkeletonHolder
|
TableEnd = emitLoclistsTableHeader(Asm, *this);
|
||||||
: InfoHolder);
|
|
||||||
} else {
|
} else {
|
||||||
Asm->OutStreamer->SwitchSection(
|
Asm->OutStreamer->SwitchSection(
|
||||||
Asm->getObjFileLowering().getDwarfLocSection());
|
Asm->getObjFileLowering().getDwarfLocSection());
|
||||||
|
|
|
@ -80,10 +80,6 @@ class DwarfFile {
|
||||||
/// The table is shared by all units.
|
/// The table is shared by all units.
|
||||||
MCSymbol *RnglistsTableBaseSym = nullptr;
|
MCSymbol *RnglistsTableBaseSym = nullptr;
|
||||||
|
|
||||||
/// DWARF v5: The symbol that designates the base of the locations list table.
|
|
||||||
/// The table is shared by all units.
|
|
||||||
MCSymbol *LoclistsTableBaseSym = nullptr;
|
|
||||||
|
|
||||||
/// The variables of a lexical scope.
|
/// The variables of a lexical scope.
|
||||||
struct ScopeVars {
|
struct ScopeVars {
|
||||||
/// We need to sort Args by ArgNo and check for duplicates. This could also
|
/// We need to sort Args by ArgNo and check for duplicates. This could also
|
||||||
|
@ -161,9 +157,6 @@ public:
|
||||||
MCSymbol *getRnglistsTableBaseSym() const { return RnglistsTableBaseSym; }
|
MCSymbol *getRnglistsTableBaseSym() const { return RnglistsTableBaseSym; }
|
||||||
void setRnglistsTableBaseSym(MCSymbol *Sym) { RnglistsTableBaseSym = Sym; }
|
void setRnglistsTableBaseSym(MCSymbol *Sym) { RnglistsTableBaseSym = Sym; }
|
||||||
|
|
||||||
MCSymbol *getLoclistsTableBaseSym() const { return LoclistsTableBaseSym; }
|
|
||||||
void setLoclistsTableBaseSym(MCSymbol *Sym) { LoclistsTableBaseSym = Sym; }
|
|
||||||
|
|
||||||
/// \returns false if the variable was merged with a previous one.
|
/// \returns false if the variable was merged with a previous one.
|
||||||
bool addScopeVariable(LexicalScope *LS, DbgVariable *Var);
|
bool addScopeVariable(LexicalScope *LS, DbgVariable *Var);
|
||||||
|
|
||||||
|
|
|
@ -1714,15 +1714,6 @@ void DwarfUnit::addRnglistsBase() {
|
||||||
TLOF.getDwarfRnglistsSection()->getBeginSymbol());
|
TLOF.getDwarfRnglistsSection()->getBeginSymbol());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfUnit::addLoclistsBase() {
|
|
||||||
assert(DD->getDwarfVersion() >= 5 &&
|
|
||||||
"DW_AT_loclists_base requires DWARF version 5 or later");
|
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
|
||||||
addSectionLabel(getUnitDie(), dwarf::DW_AT_loclists_base,
|
|
||||||
DU->getLoclistsTableBaseSym(),
|
|
||||||
TLOF.getDwarfLoclistsSection()->getBeginSymbol());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DwarfTypeUnit::finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) {
|
void DwarfTypeUnit::finishNonUnitTypeDIE(DIE& D, const DICompositeType *CTy) {
|
||||||
addFlag(D, dwarf::DW_AT_declaration);
|
addFlag(D, dwarf::DW_AT_declaration);
|
||||||
StringRef Name = CTy->getName();
|
StringRef Name = CTy->getName();
|
||||||
|
|
|
@ -272,9 +272,6 @@ public:
|
||||||
/// Add the DW_AT_rnglists_base attribute to the unit DIE.
|
/// Add the DW_AT_rnglists_base attribute to the unit DIE.
|
||||||
void addRnglistsBase();
|
void addRnglistsBase();
|
||||||
|
|
||||||
/// Add the DW_AT_loclists_base attribute to the unit DIE.
|
|
||||||
void addLoclistsBase();
|
|
||||||
|
|
||||||
virtual DwarfCompileUnit &getCU() = 0;
|
virtual DwarfCompileUnit &getCU() = 0;
|
||||||
|
|
||||||
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
|
void constructTypeDIE(DIE &Buffer, const DICompositeType *CTy);
|
||||||
|
|
Loading…
Reference in New Issue