[LLVMdev] No DWARF line number info with HasDotLocAndDotFile = true

Richard Osborne richard at xmos.com
Tue Oct 20 09:52:29 PDT 2009


Richard Osborne wrote:
> It seems to me that emitting DWARF line number information using .loc 
> directives is currently broken. CellSPU is currently the only in tree 
> target that sets HasDotLocAndDotFile in its MCAsmInfo and I can't get it 
> to produce any line number information.
>   
I think I understand why this is happening. Since HasDotLocAndDotFile is 
set the DwarfDebug class doesn't emit the line number table as a series 
of bytes:

  // If the target is using .loc/.file, the assembler will be emitting the
  // .debug_line table automatically.
  if (MAI->hasDotLocAndDotFile())
    return;

Previously .loc directives are printed by selecting ISD::DEBUG_LOC nodes 
to pseudo instructions which print as the directive. For example:

def DWARF_LOC : Pseudo<(outs), (ins i32imm:$line, i32imm:$col, 
i32imm:$file),
           ".loc $file, $line, $col",
           [(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>;

ISD::DEBUG_LOC nodes are produced when debug stoppoints are expanded. 
However debug stoppoints are no longer produced by the frontend since 
debug info is now encoded using metadata. Therefore there are no .loc 
directives in the output and no line number information.

It looks like AsmPrinter::processDebugLoc function should be updated to 
check whether HasDotLocAndDotFile is set and if it is emit the .loc 
directive.

Does this make sense?

-- 
Richard Osborne | XMOS
http://www.xmos.com




More information about the llvm-dev mailing list