[PATCH] D41763: [DebugInfo] Align comments in debug_loc section

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 04:51:01 PST 2018


bjope created this revision.
Herald added subscribers: JDevlieghere, kristof.beyls, javed.absar, aemerson.

This commit updates the BufferByteStreamer, used by DebugLocStream
to buffer bytes/comments to put in the debug_loc section, to
make sure that the Buffer and Comments vectors are synced.
Previously, when an SLEB128 or ULEB128 was emitted together with
a comment, the vectors could be out-of-sync if the LEB encoding
added several entries to the Buffer vectors, while we only added
a single entry to the Comments vector.

The goal with this is to get the comments in the debug_loc
section in the .s file correctly aligned.

Example (using ARM as target):
Instead of

  .byte 144                     @ sub-register DW_OP_regx
  .byte 128                     @ 256
  .byte 2                       @ DW_OP_piece
  .byte 147                     @ 8
  .byte 8                       @ sub-register DW_OP_regx
  .byte 144                     @ 257
  .byte 129                     @ DW_OP_piece
  .byte 2                       @ 8
  .byte 147                     @
  .byte 8                       @

we now get

  .byte 144                     @ sub-register DW_OP_regx
  .byte 128                     @ 256
  .byte 2                       @
  .byte 147                     @ DW_OP_piece
  .byte 8                       @ 8
  .byte 144                     @ sub-register DW_OP_regx
  .byte 129                     @ 257
  .byte 2                       @
  .byte 147                     @ DW_OP_piece
  .byte 8                       @ 8


https://reviews.llvm.org/D41763

Files:
  include/llvm/Support/LEB128.h
  lib/CodeGen/AsmPrinter/ByteStreamer.h
  test/CodeGen/ARM/debug-info-qreg.ll
  test/DebugInfo/X86/dw_op_minus.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41763.128733.patch
Type: text/x-patch
Size: 3794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180105/d470dad9/attachment.bin>


More information about the llvm-commits mailing list