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