[PATCH] D65191: [llvm-objdump] Implement highlighting

Seiya Nuta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 02:20:50 PDT 2019


seiya added a comment.

In D65191#1598981 <https://reviews.llvm.org/D65191#1598981>, @JohnReagan wrote:

> Do you have a design or spec for what you consider to be "syntax highlighting?"  From the early example you show for coloring literals, registers, etc., I don't see the benefit.  For the current output, you can tell literals from registers, right?  After all, the assembler is able to re-parse them in.


The original rough design is described in this document <https://docs.google.com/document/d/1HpgtcUt02NG-2cRf6eSwGMi2fSZWOSE9vt0JPACG-VM/edit#heading=h.t1tyb9luwxl>.

In addition to this patch, I plan to implement support for symbol names, relocations, and ascii strings in .rodata, and hopefully, highlight lines by instruction types (for example, highlight jmp instructions with green just like radare2 theme <https://r2wiki.readthedocs.io/en/latest/options/e/ec/>). As a handy (not feature-rich like radare2) disassembler, simple syntax highlighting feature is attractive at least to me.

> After all, the assembler is able to re-parse them in.

I'm sorry but I can't see your point. Syntax highlighting is not for programs, but for humans to improve readability by emphasizing contexts.

> And in general, I dislike color markups in output as they always end up relying on some system/platform screen/color support.  For instance, I don't think your highlighting will work on my OpenVMS x86 system.

I agree with you that platform-independence is important too. I don't have experience with OpenVMS at all so could you explain why this patch won't work on it? This patch uses llvm::sys::Process::OutputColor internally (through raw_fd_ostream::changeColor) to avoid being platform-specific.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65191/new/

https://reviews.llvm.org/D65191





More information about the llvm-commits mailing list