This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] Prevent variable locations to overlap short comments
ClosedPublic

Authored by ikudrin on Jun 22 2021, 4:17 AM.

Details

Summary

For now, the source variable locations are printed at about the same space as the comments for disassembled code, which can make some ranges for variables disappear if a line contains comments, for example:

                                        ┠─ bar = W1
0:  add x0, x2, #2, lsl #12     // =8192┃
4:  add z31.d, z31.d, #65280    // =0xff00
8:  nop                                 ┻

The patch shifts the report a bit to allow printing comments up to approximately 16 characters without interferences.

Diff Detail

Event Timeline

ikudrin created this revision.Jun 22 2021, 4:17 AM
jhenderson added inline comments.Jun 23 2021, 12:47 AM
llvm/test/tools/llvm-objdump/ELF/AArch64/disassemble-print-comments.s
4

I think it may be best to do the --debug-vars case in a separate invocation, to show that the option has no impact on the comment output.

Same goes for the X86 test case.

llvm/tools/llvm-objdump/llvm-objdump.cpp
224

The default is mentioned in the command guide, so the doc needs updating as part of this patch.

ikudrin updated this revision to Diff 353928.Jun 23 2021, 4:37 AM
ikudrin marked 2 inline comments as done.
  • Updated the documentation
  • Added separate invocations in tests to check printing comments and debug variables together
This revision is now accepted and ready to land.Jun 23 2021, 5:25 AM
This revision was landed with ongoing or failed builds.Jun 28 2021, 12:27 AM
This revision was automatically updated to reflect the committed changes.