aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-01-07 19:32:41 +0000
committerEric Christopher <echristo@gmail.com>2013-01-07 19:32:41 +0000
commitdd8e9f395e881972b320d947de88102a0be04b70 (patch)
tree21842f103965e21cb354a45a98cc813c108576b8 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parent5b7f9216c357f1cdf507f300f396b44cb982eb3f (diff)
Add support for separating strings for the split debug info DWARF5
proposal. This leaves the strings in the skeleton die as strp, but in all dwo files they're accessed now via DW_FORM_GNU_str_index. Add support for dumping these sections and modify the fission-cu.ll testcase to have the correct strings and form. Fix a small bug in the fixed form sizes routine that involved out of array accesses for the table and add a FIXME in the extractFast routine to fix this up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 321256a613..11b853f17b 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -228,6 +228,16 @@ MCSymbol *DwarfUnits::getStringPoolEntry(StringRef Str) {
return Entry.first = Asm->GetTempSymbol(StringPref, Entry.second);
}
+unsigned DwarfUnits::getStringPoolIndex(StringRef Str) {
+ std::pair<MCSymbol*, unsigned> &Entry =
+ StringPool->GetOrCreateValue(Str).getValue();
+ if (Entry.first) return Entry.second;
+
+ Entry.second = NextStringPoolNumber++;
+ Entry.first = Asm->GetTempSymbol(StringPref, Entry.second);
+ return Entry.second;
+}
+
// Define a unique number for the abbreviation.
//
void DwarfUnits::assignAbbrevNumber(DIEAbbrev &Abbrev) {
@@ -2116,12 +2126,14 @@ void DwarfDebug::emitDebugPubTypes() {
}
// Emit strings into a string section.
-void DwarfUnits::emitStrings(const MCSection *Section) {
+void DwarfUnits::emitStrings(const MCSection *StrSection,
+ const MCSection *OffsetSection = NULL,
+ const MCSymbol *StrSecSym = NULL) {
if (StringPool->empty()) return;
// Start the dwarf str section.
- Asm->OutStreamer.SwitchSection(Section);
+ Asm->OutStreamer.SwitchSection(StrSection);
// Get all of the string pool entries and put them in an array by their ID so
// we can sort them.
@@ -2144,6 +2156,17 @@ void DwarfUnits::emitStrings(const MCSection *Section) {
Entries[i].second->getKeyLength()+1),
0/*addrspace*/);
}
+
+ // If we've got an offset section go ahead and emit that now as well.
+ if (OffsetSection) {
+ Asm->OutStreamer.SwitchSection(OffsetSection);
+ unsigned offset = 0;
+ unsigned size = 4;
+ for (unsigned i = 0, e = Entries.size(); i != e; ++i) {
+ Asm->OutStreamer.EmitIntValue(offset, size, 0);
+ offset += Entries[i].second->getKeyLength() + 1;
+ }
+ }
}
// Emit visible names into a debug str section.
@@ -2377,7 +2400,7 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const MDNode *N) {
DIUnit.getLanguage(), Die, Asm,
this, &SkeletonHolder);
// FIXME: This should be the .dwo file.
- NewCU->addString(Die, dwarf::DW_AT_GNU_dwo_name, FN);
+ NewCU->addLocalString(Die, dwarf::DW_AT_GNU_dwo_name, FN);
// FIXME: We also need DW_AT_addr_base and DW_AT_dwo_id.
@@ -2393,7 +2416,7 @@ CompileUnit *DwarfDebug::constructSkeletonCU(const MDNode *N) {
NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);
if (!CompilationDir.empty())
- NewCU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
+ NewCU->addLocalString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
SkeletonHolder.addUnit(NewCU);
@@ -2458,5 +2481,8 @@ void DwarfDebug::emitDebugAbbrevDWO() {
// sections.
void DwarfDebug::emitDebugStrDWO() {
assert(useSplitDwarf() && "No split dwarf?");
- InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection());
+ const MCSection *OffSec = Asm->getObjFileLowering().getDwarfStrOffDWOSection();
+ const MCSymbol *StrSym = DwarfStrSectionSym;
+ InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
+ OffSec, StrSym);
}