Richard Osborne
2009-Oct-20 16:10 UTC
[LLVMdev] No DWARF line number info with HasDotLocAndDotFile = true
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. Is this a known issue? I understand that there are lots of changes going on in this area. Any idea what it would take to fix? -- Richard Osborne | XMOS http://www.xmos.com
Richard Osborne
2009-Oct-20 16:52 UTC
[LLVMdev] No DWARF line number info with HasDotLocAndDotFile = true
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
Devang Patel
2009-Oct-21 17:26 UTC
[LLVMdev] No DWARF line number info with HasDotLocAndDotFile = true
Hi Richard, On Tue, Oct 20, 2009 at 9:52 AM, Richard Osborne <richard at xmos.com> wrote:> 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?Yes, it makes sense to emit .loc in processDebugLoc if the DebugLoc has changed.> > -- > Richard Osborne | XMOS > http://www.xmos.com > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- - Devang