1 // 2 // The LLVM Compiler Infrastructure 3 // 4 // This file is distributed under the University of Illinois Open Source 5 // License. See LICENSE.TXT for details. 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_TOOLS_LLVM_OBJDUMP_LLVM_OBJDUMP_H 10 #define LLVM_TOOLS_LLVM_OBJDUMP_LLVM_OBJDUMP_H 11 12 #include "llvm/DebugInfo/DIContext.h" 13 #include "llvm/Support/CommandLine.h" 14 #include "llvm/Support/Compiler.h" 15 #include "llvm/Support/DataTypes.h" 16 #include "llvm/Object/Archive.h" 17 18 namespace llvm { 19 class StringRef; 20 21 namespace object { 22 class COFFObjectFile; 23 class MachOObjectFile; 24 class ObjectFile; 25 class Archive; 26 class RelocationRef; 27 } 28 29 extern cl::opt<std::string> TripleName; 30 extern cl::opt<std::string> ArchName; 31 extern cl::opt<std::string> MCPU; 32 extern cl::list<std::string> MAttrs; 33 extern cl::list<std::string> FilterSections; 34 extern cl::opt<bool> Disassemble; 35 extern cl::opt<bool> DisassembleAll; 36 extern cl::opt<bool> NoShowRawInsn; 37 extern cl::opt<bool> PrivateHeaders; 38 extern cl::opt<bool> FirstPrivateHeader; 39 extern cl::opt<bool> ExportsTrie; 40 extern cl::opt<bool> Rebase; 41 extern cl::opt<bool> Bind; 42 extern cl::opt<bool> LazyBind; 43 extern cl::opt<bool> WeakBind; 44 extern cl::opt<bool> RawClangAST; 45 extern cl::opt<bool> UniversalHeaders; 46 extern cl::opt<bool> ArchiveHeaders; 47 extern cl::opt<bool> IndirectSymbols; 48 extern cl::opt<bool> DataInCode; 49 extern cl::opt<bool> LinkOptHints; 50 extern cl::opt<bool> InfoPlist; 51 extern cl::opt<bool> DylibsUsed; 52 extern cl::opt<bool> DylibId; 53 extern cl::opt<bool> ObjcMetaData; 54 extern cl::opt<std::string> DisSymName; 55 extern cl::opt<bool> NonVerbose; 56 extern cl::opt<bool> Relocations; 57 extern cl::opt<bool> SectionHeaders; 58 extern cl::opt<bool> SectionContents; 59 extern cl::opt<bool> SymbolTable; 60 extern cl::opt<bool> UnwindInfo; 61 extern cl::opt<bool> PrintImmHex; 62 extern cl::opt<DIDumpType> DwarfDumpType; 63 64 // Various helper functions. 65 void error(std::error_code ec); 66 bool RelocAddressLess(object::RelocationRef a, object::RelocationRef b); 67 void ParseInputMachO(StringRef Filename); 68 void printCOFFUnwindInfo(const object::COFFObjectFile* o); 69 void printMachOUnwindInfo(const object::MachOObjectFile* o); 70 void printMachOExportsTrie(const object::MachOObjectFile* o); 71 void printMachORebaseTable(const object::MachOObjectFile* o); 72 void printMachOBindTable(const object::MachOObjectFile* o); 73 void printMachOLazyBindTable(const object::MachOObjectFile* o); 74 void printMachOWeakBindTable(const object::MachOObjectFile* o); 75 void printELFFileHeader(const object::ObjectFile *o); 76 void printCOFFFileHeader(const object::ObjectFile *o); 77 void printCOFFSymbolTable(const object::COFFObjectFile *o); 78 void printMachOFileHeader(const object::ObjectFile *o); 79 void printMachOLoadCommands(const object::ObjectFile *o); 80 void printExportsTrie(const object::ObjectFile *o); 81 void printRebaseTable(const object::ObjectFile *o); 82 void printBindTable(const object::ObjectFile *o); 83 void printLazyBindTable(const object::ObjectFile *o); 84 void printWeakBindTable(const object::ObjectFile *o); 85 void printRawClangAST(const object::ObjectFile *o); 86 void PrintRelocations(const object::ObjectFile *o); 87 void PrintSectionHeaders(const object::ObjectFile *o); 88 void PrintSectionContents(const object::ObjectFile *o); 89 void PrintSymbolTable(const object::ObjectFile *o, StringRef ArchiveName, 90 StringRef ArchitectureName = StringRef()); 91 LLVM_ATTRIBUTE_NORETURN void error(Twine Message); 92 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, std::error_code EC); 93 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, llvm::Error E); 94 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef FileName, 95 StringRef ArchiveName, 96 llvm::Error E, 97 StringRef ArchitectureName 98 = StringRef()); 99 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef ArchiveName, 100 const object::Archive::Child &C, 101 llvm::Error E, 102 StringRef ArchitectureName 103 = StringRef()); 104 105 } // end namespace llvm 106 107 #endif 108