[llvm] r243041 - [llvm-objdump] Add -D and --disassemble-all flags that attempt disassembly on all sections instead of just text sections.
Colin LeMahieu
colinl at codeaurora.org
Thu Jul 23 13:58:50 PDT 2015
Author: colinl
Date: Thu Jul 23 15:58:49 2015
New Revision: 243041
URL: http://llvm.org/viewvc/llvm-project?rev=243041&view=rev
Log:
[llvm-objdump] Add -D and --disassemble-all flags that attempt disassembly on all sections instead of just text sections.
Added:
llvm/trunk/test/tools/llvm-objdump/disassemble-data.test
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
llvm/trunk/tools/llvm-objdump/llvm-objdump.h
Added: llvm/trunk/test/tools/llvm-objdump/disassemble-data.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/disassemble-data.test?rev=243041&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/disassemble-data.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/disassemble-data.test Thu Jul 23 15:58:49 2015
@@ -0,0 +1,6 @@
+// This test checks that -D disassembles from a data section
+// RUN: llvm-mc -filetype=obj -o - %s | llvm-objdump -D - | FileCheck %s
+
+// CHECK: Disassembly of section .data:
+.data
+.word 0x0
\ No newline at end of file
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=243041&r1=243040&r2=243041&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Thu Jul 23 15:58:49 2015
@@ -70,7 +70,14 @@ llvm::Disassemble("disassemble",
cl::desc("Display assembler mnemonics for the machine instructions"));
static cl::alias
Disassembled("d", cl::desc("Alias for --disassemble"),
- cl::aliasopt(Disassemble));
+ cl::aliasopt(Disassemble));
+
+cl::opt<bool>
+llvm::DisassembleAll("disassemble-all",
+ cl::desc("Display assembler mnemonics for the machine instructions"));
+static cl::alias
+DisassembleAlld("D", cl::desc("Alias for --disassemble-all"),
+ cl::aliasopt(DisassembleAll));
cl::opt<bool>
llvm::Relocations("r", cl::desc("Display the relocation entries in the file"));
@@ -837,7 +844,7 @@ static void DisassembleObject(const Obje
}
for (const SectionRef &Section : Obj->sections()) {
- if (!Section.isText() || Section.isVirtual())
+ if (!DisassembleAll && (!Section.isText() || Section.isVirtual()))
continue;
uint64_t SectionAddr = Section.getAddress();
@@ -1514,6 +1521,8 @@ int main(int argc, char **argv) {
if (InputFilenames.size() == 0)
InputFilenames.push_back("a.out");
+ if (DisassembleAll)
+ Disassemble = true;
if (!Disassemble
&& !Relocations
&& !SectionHeaders
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.h?rev=243041&r1=243040&r2=243041&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.h (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.h Thu Jul 23 15:58:49 2015
@@ -26,7 +26,8 @@ extern cl::opt<std::string> ArchName;
extern cl::opt<std::string> MCPU;
extern cl::list<std::string> MAttrs;
extern cl::list<std::string> DumpSections;
-extern cl::opt<bool> Disassemble;
+extern cl::opt<bool> Disassemble;
+extern cl::opt<bool> DisassembleAll;
extern cl::opt<bool> NoShowRawInsn;
extern cl::opt<bool> PrivateHeaders;
extern cl::opt<bool> ExportsTrie;
More information about the llvm-commits
mailing list