summaryrefslogtreecommitdiff
path: root/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2012-11-20 22:57:02 +0000
committerEli Bendersky <eliben@google.com>2012-11-20 22:57:02 +0000
commit8b9da530e3637fd4afb33f80673178dcc74397f0 (patch)
tree584417848ffa4c0590afd288883037fc372c33c0 /tools/llvm-objdump/llvm-objdump.cpp
parent7372a7d5f87bf1ff65d07f25bae037ddc4df994d (diff)
downloadllvm-8b9da530e3637fd4afb33f80673178dcc74397f0.tar.gz
llvm-8b9da530e3637fd4afb33f80673178dcc74397f0.tar.bz2
llvm-8b9da530e3637fd4afb33f80673178dcc74397f0.tar.xz
Add the -no-show-raw-insn option to llvm-objdump, thus making it a bit more
conformant to binutils objdump. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168393 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--tools/llvm-objdump/llvm-objdump.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp
index 13ea4e3295..ddfcca3938 100644
--- a/tools/llvm-objdump/llvm-objdump.cpp
+++ b/tools/llvm-objdump/llvm-objdump.cpp
@@ -100,6 +100,10 @@ MAttrs("mattr",
cl::desc("Target specific attributes"),
cl::value_desc("a1,+a2,-a3,..."));
+static cl::opt<bool>
+NoShowRawInsn("no-show-raw-insn", cl::desc("When disassembling instructions, "
+ "do not print the instruction bytes."));
+
static StringRef ToolName;
static bool error(error_code ec) {
@@ -321,8 +325,11 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
if (DisAsm->getInstruction(Inst, Size, memoryObject, Index,
DebugOut, nulls())) {
- outs() << format("%8" PRIx64 ":\t", SectionAddr + Index);
- DumpBytes(StringRef(Bytes.data() + Index, Size));
+ outs() << format("%8" PRIx64 ":", SectionAddr + Index);
+ if (!NoShowRawInsn) {
+ outs() << "\t";
+ DumpBytes(StringRef(Bytes.data() + Index, Size));
+ }
IP->printInst(&Inst, outs(), "");
outs() << "\n";
} else {