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 COFFImportFile; 24 class MachOObjectFile; 25 class ObjectFile; 26 class Archive; 27 class RelocationRef; 28 } 29 30 extern cl::opt<std::string> TripleName; 31 extern cl::opt<std::string> ArchName; 32 extern cl::opt<std::string> MCPU; 33 extern cl::list<std::string> MAttrs; 34 extern cl::list<std::string> FilterSections; 35 extern cl::opt<bool> Disassemble; 36 extern cl::opt<bool> DisassembleAll; 37 extern cl::opt<bool> NoShowRawInsn; 38 extern cl::opt<bool> PrivateHeaders; 39 extern cl::opt<bool> FirstPrivateHeader; 40 extern cl::opt<bool> ExportsTrie; 41 extern cl::opt<bool> Rebase; 42 extern cl::opt<bool> Bind; 43 extern cl::opt<bool> LazyBind; 44 extern cl::opt<bool> WeakBind; 45 extern cl::opt<bool> RawClangAST; 46 extern cl::opt<bool> UniversalHeaders; 47 extern cl::opt<bool> ArchiveHeaders; 48 extern cl::opt<bool> IndirectSymbols; 49 extern cl::opt<bool> DataInCode; 50 extern cl::opt<bool> LinkOptHints; 51 extern cl::opt<bool> InfoPlist; 52 extern cl::opt<bool> DylibsUsed; 53 extern cl::opt<bool> DylibId; 54 extern cl::opt<bool> ObjcMetaData; 55 extern cl::opt<std::string> DisSymName; 56 extern cl::opt<bool> NonVerbose; 57 extern cl::opt<bool> Relocations; 58 extern cl::opt<bool> SectionHeaders; 59 extern cl::opt<bool> SectionContents; 60 extern cl::opt<bool> SymbolTable; 61 extern cl::opt<bool> UnwindInfo; 62 extern cl::opt<bool> PrintImmHex; 63 extern cl::opt<DIDumpType> DwarfDumpType; 64 65 // Various helper functions. 66 void error(std::error_code ec); 67 bool RelocAddressLess(object::RelocationRef a, object::RelocationRef b); 68 void ParseInputMachO(StringRef Filename); 69 void printCOFFUnwindInfo(const object::COFFObjectFile* o); 70 void printMachOUnwindInfo(const object::MachOObjectFile* o); 71 void printMachOExportsTrie(const object::MachOObjectFile* o); 72 void printMachORebaseTable(const object::MachOObjectFile* o); 73 void printMachOBindTable(const object::MachOObjectFile* o); 74 void printMachOLazyBindTable(const object::MachOObjectFile* o); 75 void printMachOWeakBindTable(const object::MachOObjectFile* o); 76 void printELFFileHeader(const object::ObjectFile *o); 77 void printCOFFFileHeader(const object::ObjectFile *o); 78 void printCOFFSymbolTable(const object::COFFImportFile *i); 79 void printCOFFSymbolTable(const object::COFFObjectFile *o); 80 void printMachOFileHeader(const object::ObjectFile *o); 81 void printMachOLoadCommands(const object::ObjectFile *o); 82 void printWasmFileHeader(const object::ObjectFile *o); 83 void printExportsTrie(const object::ObjectFile *o); 84 void printRebaseTable(const object::ObjectFile *o); 85 void printBindTable(const object::ObjectFile *o); 86 void printLazyBindTable(const object::ObjectFile *o); 87 void printWeakBindTable(const object::ObjectFile *o); 88 void printRawClangAST(const object::ObjectFile *o); 89 void PrintRelocations(const object::ObjectFile *o); 90 void PrintSectionHeaders(const object::ObjectFile *o); 91 void PrintSectionContents(const object::ObjectFile *o); 92 void PrintSymbolTable(const object::ObjectFile *o, StringRef ArchiveName, 93 StringRef ArchitectureName = StringRef()); 94 LLVM_ATTRIBUTE_NORETURN void error(Twine Message); 95 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, Twine Message); 96 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, std::error_code EC); 97 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, llvm::Error E); 98 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef FileName, 99 StringRef ArchiveName, 100 llvm::Error E, 101 StringRef ArchitectureName 102 = StringRef()); 103 LLVM_ATTRIBUTE_NORETURN void report_error(StringRef ArchiveName, 104 const object::Archive::Child &C, 105 llvm::Error E, 106 StringRef ArchitectureName 107 = StringRef()); 108 109 } // end namespace llvm 110 111 #endif 112