llvm.org GIT mirror llvm / ea80502
[llvm-objdump] Add -D and --disassemble-all flags that attempt disassembly on all sections instead of just text sections. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243041 91177308-0d34-0410-b5e6-96231b3b80d8 Colin LeMahieu 5 years ago
3 changed file(s) with 19 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
0 // This test checks that -D disassembles from a data section
1 // RUN: llvm-mc -filetype=obj -o - %s | llvm-objdump -D - | FileCheck %s
2
3 // CHECK: Disassembly of section .data:
4 .data
5 .word 0x0
6969 cl::desc("Display assembler mnemonics for the machine instructions"));
7070 static cl::alias
7171 Disassembled("d", cl::desc("Alias for --disassemble"),
72 cl::aliasopt(Disassemble));
72 cl::aliasopt(Disassemble));
73
74 cl::opt
75 llvm::DisassembleAll("disassemble-all",
76 cl::desc("Display assembler mnemonics for the machine instructions"));
77 static cl::alias
78 DisassembleAlld("D", cl::desc("Alias for --disassemble-all"),
79 cl::aliasopt(DisassembleAll));
7380
7481 cl::opt
7582 llvm::Relocations("r", cl::desc("Display the relocation entries in the file"));
836843 }
837844
838845 for (const SectionRef &Section : Obj->sections()) {
839 if (!Section.isText() || Section.isVirtual())
846 if (!DisassembleAll && (!Section.isText() || Section.isVirtual()))
840847 continue;
841848
842849 uint64_t SectionAddr = Section.getAddress();
15131520 if (InputFilenames.size() == 0)
15141521 InputFilenames.push_back("a.out");
15151522
1523 if (DisassembleAll)
1524 Disassemble = true;
15161525 if (!Disassemble
15171526 && !Relocations
15181527 && !SectionHeaders
2525 extern cl::opt MCPU;
2626 extern cl::list MAttrs;
2727 extern cl::list DumpSections;
28 extern cl::opt Disassemble;
28 extern cl::opt Disassemble;
29 extern cl::opt DisassembleAll;
2930 extern cl::opt NoShowRawInsn;
3031 extern cl::opt PrivateHeaders;
3132 extern cl::opt ExportsTrie;