Enable assembly highlighting in llvm-objdump.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
GNU objdump from 2.39 onwards provides --disassembler-color=on. I wonder whether we want similar option names, but I can see that --disassembler-color=on is long and inconvenient..
I expect this flag to be mostly used for writing tests so I'm not too worried about being verbose. FWIW I ended up going for the two separate flags because no other objdump options take a predefined set of options (there's a few ones that take arbitrary strings such as --debug-vars= or --arch-name=) but if we feel that something like --disassembler-color={on, off, auto} is the right thing to do, then I'm happy to go that route.
Sounds good. objdump uses terminal instead of auto.
% objdump --help ... --disassembler-color=off Disable disassembler color output. (default) --disassembler-color=terminal Enable disassembler color output if displaying on a terminal. --disassembler-color=on Enable disassembler color output. --disassembler-color=extended Use 8-bit colors in disassembler output.
Address @jhenderson's feedback.
llvm/docs/CommandGuide/llvm-objdump.rst | ||
---|---|---|
183 | No, good catch. That's a copy/paste error. |
This breaks tests on windows: http://45.33.8.238/win/83747/step_11.txt
Please take a look and revert for now if it takes a while to fix.
The newly added test tools/llvm-objdump/MachO/arm64-disassembly-color.s is failing if AArch64 backend is not available, sounds like a REQUIRES is needed?
https://lab.llvm.org/buildbot/#/builders/139/builds/48856
******************** TEST 'LLVM :: tools/llvm-objdump/MachO/arm64-disassembly-color.s' FAILED ******************** Exit Code: 1 Command Output (stderr): -- + : 'RUN: at line 1' + /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc -triple arm64-apple-macosx /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/tools/llvm-objdump/MachO/arm64-disassembly-color.s -filetype=obj -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llvm-objdump/MachO/Output/arm64-disassembly-color.s.tmp /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple. -- ********************
This is a very welcomed change! Have I really not run the disassembler since this landed?
Is this really a -M option, given that that is the option for --disassembler-options?