[MC/DWARF] Generate multiple .debug_line entries for adjacent .loc directives

Ulrich Weigand Ulrich.Weigand at de.ibm.com
Fri Jun 7 10:10:07 PDT 2013


Hello,

The compiler occasionally generates multiple .loc directives in a row
(at the same instruction address).  These need to be transformed into
multple actual .debug_line table entries, since they are used to signal
certain information to the debugger (e.g. if the opening brace of a
function body is on the same line as the declaration).

The MCAsmStreamer version of EmitDwarfLocDirective handles this
correctly by emitting a .loc directive every time it is called.
However, the MCObjectStream version simply defaults to recording
the information and emitting only a single table entry later,
e.g. when EmitInstruction is called.

This patch introduces a MCAsmStreamer::EmitDwarfLocDirective
version that emits a line table entry for a .loc directive
that may already be pending before recording the new directive.
(This is similar to how this is handled in GNU as.)

With this patch (and the code alignment factor patch) applied,
I'm now getting identical DEBUG .debug sections for all test-suite
object files on PowerPC for the internal and the external assembler.

Does this look OK?

Thanks,
Ulrich
(See attached file: diff-llvm-mc-doubleloc)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff-llvm-mc-doubleloc
Type: application/octet-stream
Size: 3283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130607/bf936b67/attachment.obj>


More information about the llvm-commits mailing list