diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-02-08 18:11:31 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2017-02-08 18:11:31 +0000 |
commit | 5bbd1892069a439883c50bde4b698ae386e260af (patch) | |
tree | 3f6dd88330a8147c6f1e5baafcbe373f5223b290 /tools/llvm-objdump/llvm-objdump.cpp | |
parent | a10aff5b133f9a9b36106b700e84e75b47bb5361 (diff) |
llvm-objdump: make NoLeadingAddr work on more than just MachO
Support printing the disassembly without the address on all formats
rather than making it MachO specific.
Patch by Jeff Muizelaar!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294495 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r-- | tools/llvm-objdump/llvm-objdump.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index fb144faca51..d81cb8878b7 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -158,6 +158,8 @@ cl::opt<bool> llvm::NoShowRawInsn("no-show-raw-insn", cl::desc("When disassembling " "instructions, do not print " "the instruction bytes.")); +cl::opt<bool> +llvm::NoLeadingAddr("no-leading-addr", cl::desc("Print no leading address")); cl::opt<bool> llvm::UnwindInfo("unwind-info", cl::desc("Display unwind information")); @@ -510,7 +512,8 @@ public: MCSubtargetInfo const &STI, SourcePrinter *SP) { if (SP && (PrintSource || PrintLines)) SP->printSourceLine(OS, Address); - OS << format("%8" PRIx64 ":", Address); + if (!NoLeadingAddr) + OS << format("%8" PRIx64 ":", Address); if (!NoShowRawInsn) { OS << "\t"; dumpBytes(Bytes, OS); @@ -528,7 +531,8 @@ public: raw_ostream &OS) { uint32_t opcode = (Bytes[3] << 24) | (Bytes[2] << 16) | (Bytes[1] << 8) | Bytes[0]; - OS << format("%8" PRIx64 ":", Address); + if (!NoLeadingAddr) + OS << format("%8" PRIx64 ":", Address); if (!NoShowRawInsn) { OS << "\t"; dumpBytes(Bytes.slice(0, 4), OS); @@ -620,7 +624,8 @@ public: MCSubtargetInfo const &STI, SourcePrinter *SP) override { if (SP && (PrintSource || PrintLines)) SP->printSourceLine(OS, Address); - OS << format("%8" PRId64 ":", Address / 8); + if (!NoLeadingAddr) + OS << format("%8" PRId64 ":", Address / 8); if (!NoShowRawInsn) { OS << "\t"; dumpBytes(Bytes, OS); |