aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-05-08 21:03:15 +0000
committerBill Wendling <isanbard@gmail.com>2009-05-08 21:03:15 +0000
commitf7e625587a1af7c6d27133644fa80e205473d41e (patch)
treed368fdbec5fa2ce297f9fa30b4802e111689b9b6 /lib/CodeGen/AsmPrinter/DwarfWriter.cpp
parentca5a39e6ad1f61a060395174716f53b7e5edae75 (diff)
downloadexternal_llvm-f7e625587a1af7c6d27133644fa80e205473d41e.zip
external_llvm-f7e625587a1af7c6d27133644fa80e205473d41e.tar.gz
external_llvm-f7e625587a1af7c6d27133644fa80e205473d41e.tar.bz2
Compute the offsets of the compile units. We need this so that when we emit a
concrete instance of an inlined function, we can get the actual address of the abstract instance inside of the compile unit. This isn't currently used, but will be by a future check-in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71263 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfWriter.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfWriter.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index 1739ec9..1409feb9 100644
--- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -1289,6 +1289,11 @@ class DwarfDebug : public Dwarf {
/// variables.
DenseMap<const MachineInstr *, DbgScope *> InlinedVariableScopes;
+ /// CompileUnitOffsets - A vector of the offsets of the compile units. This is
+ /// used when calculating the "origin" of a concrete instance of an inlined
+ /// function.
+ DenseMap<CompileUnit *, unsigned> CompileUnitOffsets;
+
/// DebugTimer - Timer for the Dwarf debug writer.
Timer *DebugTimer;
@@ -2360,24 +2365,28 @@ private:
/// SizeAndOffsets - Compute the size and offset of all the DIEs.
///
void SizeAndOffsets() {
+ // Compute size of compile unit header.
+ static 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)
+
// Process base compile unit.
if (MainCU) {
- // 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(MainCU->getDie(), Offset, true);
+ CompileUnitOffsets[MainCU] = 0;
return;
}
+
+ // Process all compile units.
+ unsigned PrevOffset = 0;
+
for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) {
CompileUnit *Unit = CompileUnits[i];
- // 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);
+ CompileUnitOffsets[Unit] = PrevOffset;
+ PrevOffset += SizeAndOffsetDie(Unit->getDie(), Offset, true)
+ + sizeof(int32_t); // FIXME - extra pad for gdb bug.
}
}