[all-commits] [llvm/llvm-project] c6ff80: [llvm-mc] Add --hex to disassemble hex bytes

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Dec 16 21:05:30 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c6ff809ae9acbc90455dc8b58b2dae84a13366cf
      https://github.com/llvm/llvm-project/commit/c6ff809ae9acbc90455dc8b58b2dae84a13366cf
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-12-16 (Mon, 16 Dec 2024)

  Changed paths:
    M llvm/docs/CommandGuide/llvm-mc.rst
    A llvm/test/MC/Disassembler/X86/hex-bytes.txt
    M llvm/tools/llvm-mc/Disassembler.cpp
    M llvm/tools/llvm-mc/Disassembler.h
    M llvm/tools/llvm-mc/llvm-mc.cpp

  Log Message:
  -----------
  [llvm-mc] Add --hex to disassemble hex bytes

`--disassemble`/`--cdis` parses input bytes as decimal, 0bbin, 0ooct, or
0xhex. While the hexadecimal digit form is most commonly used, requiring
a 0x prefix for each byte (`0x48 0x29 0xc3`) is cumbersome.

Tools like xxd -p and rz-asm use a plain hex dump form without the 0x
prefix or space separator. This patch adds --hex to disassemble such hex
bytes with optional whitespace.

```
% rz-asm -a x86 -b 64 -d 4829c34829c4
sub rbx, rax
sub rsp, rax

% llvm-mc -triple=x86_64 --cdis --hex --output-asm-variant=1 <<< 4829c34829c4
        .text
        sub     rbx, rax
        sub     rsp, rax
```

Pull Request: https://github.com/llvm/llvm-project/pull/119992



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list