Implement the source and line number interleaving with the disassembly.
Diff Detail
- Repository
- rL LLVM
Event Timeline
I'd suggest compiling down a source file to .ll, but keeping it in an Inputs directory for the tool to use in order to match source to object. You may have to modify the debug info in the IR slightly, but maybe not.
-eric
Made changes so all pretty printers can interleave source with disassembly. Added tests that test X86 and Hexagon printers.
I think it would be better to split the hexagon support into a separate (trivial) patch. That would make this change only add the source and line number printing and tests for x86. The hexagon change would then add that target as well.
Got it. I will split this into two patches.
tools/llvm-objdump/llvm-objdump.cpp | ||
---|---|---|
383 | The comment should have been for line 385. The source files need to be opened and displayed when a line info is valid. The files may have to live till end of disassembly since using linker scripts the sections may have been laid out such that source from one file may need to be displayed at any point during disassembly. | |
400 | Sure a single "; " can be added. | |
1308 | Somehow clang format in one of the intermediate commits I squashed for this change may have triggered this. |
Removed hexagon changes to leave only generic pretty printer changes. Hexagon will be added as a separate patch.
test/tools/llvm-objdump/X86/Inputs/source-interleave-x86_64.c | ||
---|---|---|
12 | Might be nice to clang-format this file before checkin. It hurts my sense of aesthetics :-p. | |
test/tools/llvm-objdump/X86/source-interleave.s | ||
5 ↗ | (On Diff #67755) | Is there a reason to prefer ASM over LLVM IR here? If we use LLVM IR, it might be much shorter. Since the DI should reference the LineNumber, I think that the test output should be consistent. |
@compnerd. You are right, IR is better choice for test. Formatted the test too. Please +1 the change.
Thanks for the work on this! (BTW, feel free to add me to the other patch to add the hexagon stuff since I asked you to split that up, Im happy to do the extra work to review it).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278725 91177308-0d34-0410-b5e6-96231b3b80d8
Might be nice to clang-format this file before checkin. It hurts my sense of aesthetics :-p.