blob: c50caae5b58cedae5b76975616ad3204412c8d64 [file] [log] [blame]
Benjamin Kramer43a772e2011-09-19 17:56:04 +00001//
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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +00009#ifndef LLVM_TOOLS_LLVM_OBJDUMP_LLVM_OBJDUMP_H
10#define LLVM_TOOLS_LLVM_OBJDUMP_LLVM_OBJDUMP_H
Benjamin Kramer43a772e2011-09-19 17:56:04 +000011
12#include "llvm/ADT/StringRef.h"
Igor Laevsky03a670c2016-01-26 15:09:42 +000013#include "llvm/DebugInfo/DIContext.h"
Benjamin Kramer43a772e2011-09-19 17:56:04 +000014#include "llvm/Support/CommandLine.h"
Davide Italianoed9d95b2015-12-29 13:41:02 +000015#include "llvm/Support/Compiler.h"
Benjamin Kramer43a772e2011-09-19 17:56:04 +000016#include "llvm/Support/DataTypes.h"
Benjamin Kramer43a772e2011-09-19 17:56:04 +000017
18namespace llvm {
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000019namespace object {
20 class COFFObjectFile;
Tim Northover4bd286a2014-08-01 13:07:19 +000021 class MachOObjectFile;
Michael J. Spencer209565db2013-01-06 03:56:49 +000022 class ObjectFile;
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000023 class RelocationRef;
24}
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000025
Benjamin Kramer43a772e2011-09-19 17:56:04 +000026extern cl::opt<std::string> TripleName;
27extern cl::opt<std::string> ArchName;
Kevin Enderbyc9595622014-08-06 23:24:41 +000028extern cl::opt<std::string> MCPU;
29extern cl::list<std::string> MAttrs;
Colin LeMahieufcc32762015-07-29 19:08:10 +000030extern cl::list<std::string> FilterSections;
Colin LeMahieu77804be2015-07-29 15:45:39 +000031extern cl::opt<bool> Disassemble;
Colin LeMahieuf34933e2015-07-23 20:58:49 +000032extern cl::opt<bool> DisassembleAll;
Kevin Enderbybf246f52014-09-24 23:08:22 +000033extern cl::opt<bool> NoShowRawInsn;
Kevin Enderbye2297dd2015-01-07 21:02:18 +000034extern cl::opt<bool> PrivateHeaders;
Kevin Enderby0ae163f2016-01-13 00:25:36 +000035extern cl::opt<bool> FirstPrivateHeader;
Kevin Enderbye2297dd2015-01-07 21:02:18 +000036extern cl::opt<bool> ExportsTrie;
37extern cl::opt<bool> Rebase;
38extern cl::opt<bool> Bind;
39extern cl::opt<bool> LazyBind;
40extern cl::opt<bool> WeakBind;
Adrian Prantl437105a2015-07-08 02:04:15 +000041extern cl::opt<bool> RawClangAST;
Kevin Enderby131d1772015-01-09 19:22:37 +000042extern cl::opt<bool> UniversalHeaders;
Kevin Enderby13023a12015-01-15 23:19:11 +000043extern cl::opt<bool> ArchiveHeaders;
Kevin Enderbya7bdc7e2015-01-22 18:55:27 +000044extern cl::opt<bool> IndirectSymbols;
Kevin Enderby69fe98d2015-01-23 18:52:17 +000045extern cl::opt<bool> DataInCode;
Kevin Enderby9a509442015-01-27 21:28:24 +000046extern cl::opt<bool> LinkOptHints;
Kevin Enderbycd66be52015-03-11 22:06:32 +000047extern cl::opt<bool> InfoPlist;
Kevin Enderbybc847fa2015-03-16 20:08:09 +000048extern cl::opt<bool> DylibsUsed;
49extern cl::opt<bool> DylibId;
Kevin Enderby0fc11822015-04-01 20:57:01 +000050extern cl::opt<bool> ObjcMetaData;
Kevin Enderby6a221752015-03-17 17:10:57 +000051extern cl::opt<std::string> DisSymName;
Kevin Enderbyf0640752015-03-13 17:56:32 +000052extern cl::opt<bool> NonVerbose;
Kevin Enderby98da6132015-01-20 21:47:46 +000053extern cl::opt<bool> Relocations;
54extern cl::opt<bool> SectionHeaders;
55extern cl::opt<bool> SectionContents;
56extern cl::opt<bool> SymbolTable;
57extern cl::opt<bool> UnwindInfo;
Colin LeMahieu14ec76e2015-06-07 21:07:17 +000058extern cl::opt<bool> PrintImmHex;
Igor Laevsky03a670c2016-01-26 15:09:42 +000059extern cl::opt<DIDumpType> DwarfDumpType;
Benjamin Kramer43a772e2011-09-19 17:56:04 +000060
61// Various helper functions.
Davide Italianoccd53fe2015-08-05 07:18:31 +000062void error(std::error_code ec);
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000063bool RelocAddressLess(object::RelocationRef a, object::RelocationRef b);
Kevin Enderbye2297dd2015-01-07 21:02:18 +000064void ParseInputMachO(StringRef Filename);
Michael J. Spencer0c6ec482012-12-05 20:12:35 +000065void printCOFFUnwindInfo(const object::COFFObjectFile* o);
Tim Northover4bd286a2014-08-01 13:07:19 +000066void printMachOUnwindInfo(const object::MachOObjectFile* o);
Nick Kledzikd04bc352014-08-30 00:20:14 +000067void printMachOExportsTrie(const object::MachOObjectFile* o);
Nick Kledzikac431442014-09-12 21:34:15 +000068void printMachORebaseTable(const object::MachOObjectFile* o);
Nick Kledzik56ebef42014-09-16 01:41:51 +000069void printMachOBindTable(const object::MachOObjectFile* o);
70void printMachOLazyBindTable(const object::MachOObjectFile* o);
71void printMachOWeakBindTable(const object::MachOObjectFile* o);
Michael J. Spencer209565db2013-01-06 03:56:49 +000072void printELFFileHeader(const object::ObjectFile *o);
Rui Ueyamac2bed422013-09-27 21:04:00 +000073void printCOFFFileHeader(const object::ObjectFile *o);
Davide Italianoe85abf72015-12-20 09:54:34 +000074void printCOFFSymbolTable(const object::COFFObjectFile *o);
Kevin Enderbyb76d3862014-08-22 20:35:18 +000075void printMachOFileHeader(const object::ObjectFile *o);
Kevin Enderby0ae163f2016-01-13 00:25:36 +000076void printMachOLoadCommands(const object::ObjectFile *o);
Kevin Enderbye2297dd2015-01-07 21:02:18 +000077void printExportsTrie(const object::ObjectFile *o);
78void printRebaseTable(const object::ObjectFile *o);
79void printBindTable(const object::ObjectFile *o);
80void printLazyBindTable(const object::ObjectFile *o);
81void printWeakBindTable(const object::ObjectFile *o);
Adrian Prantl437105a2015-07-08 02:04:15 +000082void printRawClangAST(const object::ObjectFile *o);
Kevin Enderby98da6132015-01-20 21:47:46 +000083void PrintRelocations(const object::ObjectFile *o);
84void PrintSectionHeaders(const object::ObjectFile *o);
85void PrintSectionContents(const object::ObjectFile *o);
86void PrintSymbolTable(const object::ObjectFile *o);
Davide Italianoed9d95b2015-12-29 13:41:02 +000087LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, std::error_code EC);
Benjamin Kramer43a772e2011-09-19 17:56:04 +000088
Rui Ueyamac2bed422013-09-27 21:04:00 +000089} // end namespace llvm
Benjamin Kramer43a772e2011-09-19 17:56:04 +000090
91#endif