[llvm-commits] [llvm] r103439 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfDebug.h test/DebugInfo/2010-05-10-MultipleCU.ll

Benjamin Kramer benny.kra at googlemail.com
Tue Sep 28 08:17:39 PDT 2010


Hi Devang,

one late comment below


On 11.05.2010, at 00:49, Devang Patel wrote:

> Author: dpatel
> Date: Mon May 10 17:49:55 2010
> New Revision: 103439
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=103439&view=rev
> Log:
> Enable multiple Compile Units in one module.
> This means now 'llvm-ld a.bc b.bc' will preserve debug info appropriately.
> 
> Added:
>    llvm/trunk/test/DebugInfo/2010-05-10-MultipleCU.ll
> Modified:
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
> 
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=103439&r1=103438&r2=103439&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon May 10 17:49:55 2010
> @@ -2670,14 +2713,18 @@
> /// computeSizeAndOffsets - Compute the size and offset of all the DIEs.
> ///
> void DwarfDebug::computeSizeAndOffsets() {
> -  // 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)
> -
> -  computeSizeAndOffset(ModuleCU->getCUDie(), Offset, true);
> +  unsigned PrevOffset = 0;
> +  for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
> +         E = CUMap.end(); I != E; ++I) {
> +    // Compute size of compile unit header.
> +    static unsigned Offset = PrevOffset +

Why is this variable static? PrevOffset is 0 when the var is hit the first time so the
offset will be constant (11). I tried to remove the static keyword but that seems to corrupt
the dwarf output in 2010-05-10-MultipleCU.ll. Can you take a look?

> +      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)
> +    computeSizeAndOffset(I->second->getCUDie(), Offset, true);
> +    PrevOffset = Offset;
> +  }
> }




More information about the llvm-commits mailing list