aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-01-12 23:05:55 +0000
committerDevang Patel <dpatel@apple.com>2009-01-12 23:05:55 +0000
commit6eae283d4962b1c38d3c6fa0100c0d605f6f4100 (patch)
tree48bc8b83287dca4b39eac3f1ec90c7b82099bba0
parent57ec9acc70150b4e8f652179287fc51077c3691d (diff)
downloadexternal_llvm-6eae283d4962b1c38d3c6fa0100c0d605f6f4100.zip
external_llvm-6eae283d4962b1c38d3c6fa0100c0d605f6f4100.tar.gz
external_llvm-6eae283d4962b1c38d3c6fa0100c0d605f6f4100.tar.bz2
If multiple compile units are seen then emit them independently. In other words, do not force all DIEs into first, whatever it is, compile unit.
Note, multiple compile unit support is not well tested (it did not work correctly until now anyway.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62116 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfWriter.cpp139
1 files changed, 74 insertions, 65 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index e7d8a0a..acbec3c 100644
--- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -2952,13 +2952,16 @@ private:
///
void SizeAndOffsets() {
// Process base compile unit.
- CompileUnit *Unit = GetBaseCompileUnit();
- // Compute size of compile unit header
- unsigned Offset = sizeof(int32_t) + // Length of Compilation Unit Info
- sizeof(int16_t) + // DWARF version number
- sizeof(int32_t) + // Offset Into Abbrev. Section
- sizeof(int8_t); // Pointer Size (in bytes)
- SizeAndOffsetDie(Unit->getDie(), Offset, true);
+ for (DenseMap<Value *, CompileUnit *>::iterator CI = DW_CUs.begin(),
+ CE = DW_CUs.end(); CI != CE; ++CI) {
+ CompileUnit *Unit = CI->second;
+ // Compute size of compile unit header
+ unsigned Offset = sizeof(int32_t) + // Length of Compilation Unit Info
+ sizeof(int16_t) + // DWARF version number
+ sizeof(int32_t) + // Offset Into Abbrev. Section
+ sizeof(int8_t); // Pointer Size (in bytes)
+ SizeAndOffsetDie(Unit->getDie(), Offset, true);
+ }
}
/// EmitDebugInfo - Emit the debug info section.
@@ -2967,32 +2970,35 @@ private:
// Start debug info section.
Asm->SwitchToDataSection(TAI->getDwarfInfoSection());
- CompileUnit *Unit = GetBaseCompileUnit();
- DIE *Die = Unit->getDie();
- // Emit the compile units header.
- EmitLabel("info_begin", Unit->getID());
- // Emit size of content not including length itself
- unsigned ContentSize = Die->getSize() +
- sizeof(int16_t) + // DWARF version number
- sizeof(int32_t) + // Offset Into Abbrev. Section
- sizeof(int8_t) + // Pointer Size (in bytes)
- sizeof(int32_t); // FIXME - extra pad for gdb bug.
-
- Asm->EmitInt32(ContentSize); Asm->EOL("Length of Compilation Unit Info");
- Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF version number");
- EmitSectionOffset("abbrev_begin", "section_abbrev", 0, 0, true, false);
- Asm->EOL("Offset Into Abbrev. Section");
- Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)");
-
- EmitDIE(Die);
- // FIXME - extra padding for gdb bug.
- Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
- Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
- Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
- Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
- EmitLabel("info_end", Unit->getID());
-
- Asm->EOL();
+ for (DenseMap<Value *, CompileUnit *>::iterator CI = DW_CUs.begin(),
+ CE = DW_CUs.end(); CI != CE; ++CI) {
+ CompileUnit *Unit = CI->second;
+ DIE *Die = Unit->getDie();
+ // Emit the compile units header.
+ EmitLabel("info_begin", Unit->getID());
+ // Emit size of content not including length itself
+ unsigned ContentSize = Die->getSize() +
+ sizeof(int16_t) + // DWARF version number
+ sizeof(int32_t) + // Offset Into Abbrev. Section
+ sizeof(int8_t) + // Pointer Size (in bytes)
+ sizeof(int32_t); // FIXME - extra pad for gdb bug.
+
+ Asm->EmitInt32(ContentSize); Asm->EOL("Length of Compilation Unit Info");
+ Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF version number");
+ EmitSectionOffset("abbrev_begin", "section_abbrev", 0, 0, true, false);
+ Asm->EOL("Offset Into Abbrev. Section");
+ Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)");
+
+ EmitDIE(Die);
+ // FIXME - extra padding for gdb bug.
+ Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
+ Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
+ Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
+ Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
+ EmitLabel("info_end", Unit->getID());
+
+ Asm->EOL();
+ }
}
/// EmitAbbreviations - Emit the abbreviation section.
@@ -3290,39 +3296,42 @@ private:
// Start the dwarf pubnames section.
Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection());
- CompileUnit *Unit = GetBaseCompileUnit();
-
- EmitDifference("pubnames_end", Unit->getID(),
- "pubnames_begin", Unit->getID(), true);
- Asm->EOL("Length of Public Names Info");
-
- EmitLabel("pubnames_begin", Unit->getID());
-
- Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF Version");
-
- EmitSectionOffset("info_begin", "section_info",
- Unit->getID(), 0, true, false);
- Asm->EOL("Offset of Compilation Unit Info");
-
- EmitDifference("info_end", Unit->getID(), "info_begin", Unit->getID(),true);
- Asm->EOL("Compilation Unit Length");
-
- std::map<std::string, DIE *> &Globals = Unit->getGlobals();
-
- for (std::map<std::string, DIE *>::iterator GI = Globals.begin(),
- GE = Globals.end();
- GI != GE; ++GI) {
- const std::string &Name = GI->first;
- DIE * Entity = GI->second;
-
- Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset");
- Asm->EmitString(Name); Asm->EOL("External Name");
+ for (DenseMap<Value *, CompileUnit *>::iterator CI = DW_CUs.begin(),
+ CE = DW_CUs.end(); CI != CE; ++CI) {
+ CompileUnit *Unit = CI->second;
+
+ EmitDifference("pubnames_end", Unit->getID(),
+ "pubnames_begin", Unit->getID(), true);
+ Asm->EOL("Length of Public Names Info");
+
+ EmitLabel("pubnames_begin", Unit->getID());
+
+ Asm->EmitInt16(DWARF_VERSION); Asm->EOL("DWARF Version");
+
+ EmitSectionOffset("info_begin", "section_info",
+ Unit->getID(), 0, true, false);
+ Asm->EOL("Offset of Compilation Unit Info");
+
+ EmitDifference("info_end", Unit->getID(), "info_begin", Unit->getID(),true);
+ Asm->EOL("Compilation Unit Length");
+
+ std::map<std::string, DIE *> &Globals = Unit->getGlobals();
+
+ for (std::map<std::string, DIE *>::iterator GI = Globals.begin(),
+ GE = Globals.end();
+ GI != GE; ++GI) {
+ const std::string &Name = GI->first;
+ DIE * Entity = GI->second;
+
+ Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset");
+ Asm->EmitString(Name); Asm->EOL("External Name");
+ }
+
+ Asm->EmitInt32(0); Asm->EOL("End Mark");
+ EmitLabel("pubnames_end", Unit->getID());
+
+ Asm->EOL();
}
-
- Asm->EmitInt32(0); Asm->EOL("End Mark");
- EmitLabel("pubnames_end", Unit->getID());
-
- Asm->EOL();
}
/// EmitDebugStr - Emit visible names into a debug str section.