diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-08-08 18:41:34 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-08-08 18:41:34 +0000 |
commit | c13464f3c1148a7096356f34f33932d3e258570e (patch) | |
tree | 3a4f290d2b37393f423f11c7735024474d4f17a5 /tools/llvm-objdump | |
parent | a21d81370942ae915d6229298d6a52e4d36dcc2a (diff) | |
download | external_llvm-c13464f3c1148a7096356f34f33932d3e258570e.zip external_llvm-c13464f3c1148a7096356f34f33932d3e258570e.tar.gz external_llvm-c13464f3c1148a7096356f34f33932d3e258570e.tar.bz2 |
llvm-objdump: disassembly enhancements
- Indent simple loops
- Print unreachable blocks as .byte directives
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137058 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump')
-rw-r--r-- | tools/llvm-objdump/llvm-objdump.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 7a5c911..2458af4 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -284,8 +284,23 @@ static void DisassembleInput(const StringRef &Filename) { break; } - if (!hasPreds && fi != f.begin()) + // Data block. + if (!hasPreds && fi != f.begin()) { + uint64_t End = llvm::next(fi) == fe ? SectSize : + llvm::next(fi)->first; + uint64_t addr; + if (error(i->getAddress(addr))) break; + outs() << "# " << End-fi->first << " bytes of data:\n"; + for (unsigned pos = fi->first; pos != End; ++pos) { + outs() << format("%8x:\t", addr + pos); + DumpBytes(StringRef(Bytes.data() + pos, 1)); + outs() << format("\t.byte 0x%02x\n", (uint8_t)Bytes[pos]); + } continue; + } + + if (fi->second.contains(&fi->second)) + outs() << "# Loop begin:\n"; for (unsigned ii = 0, ie = fi->second.getInsts().size(); ii != ie; ++ii) { @@ -294,6 +309,9 @@ static void DisassembleInput(const StringRef &Filename) { const MCDecodedInst &Inst = fi->second.getInsts()[ii]; outs() << format("%8x:\t", addr + Inst.Address); DumpBytes(StringRef(Bytes.data() + Inst.Address, Inst.Size)); + // Simple loops. + if (fi->second.contains(&fi->second)) + outs() << '\t'; IP->printInst(&Inst.Inst, outs()); outs() << '\n'; } |