2015-07-21 21:42:38 +08:00
|
|
|
//===-- ObjDumper.h ---------------------------------------------*- C++ -*-===//
|
2013-04-04 02:31:38 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_TOOLS_LLVM_READOBJ_OBJDUMPER_H
|
|
|
|
#define LLVM_TOOLS_LLVM_READOBJ_OBJDUMPER_H
|
2013-04-04 02:31:38 +08:00
|
|
|
|
2014-03-06 13:51:42 +08:00
|
|
|
#include <memory>
|
2014-06-13 01:38:55 +08:00
|
|
|
#include <system_error>
|
2014-03-06 13:51:42 +08:00
|
|
|
|
2013-04-04 02:31:38 +08:00
|
|
|
namespace llvm {
|
|
|
|
namespace object {
|
2015-08-28 18:27:50 +08:00
|
|
|
class COFFImportFile;
|
|
|
|
class ObjectFile;
|
2013-04-04 02:31:38 +08:00
|
|
|
}
|
2016-05-14 08:02:53 +08:00
|
|
|
namespace codeview {
|
2016-11-09 06:24:53 +08:00
|
|
|
class TypeTableBuilder;
|
2016-05-17 07:09:32 +08:00
|
|
|
}
|
2013-04-04 02:31:38 +08:00
|
|
|
|
2016-05-03 08:28:04 +08:00
|
|
|
class ScopedPrinter;
|
2013-04-04 02:31:38 +08:00
|
|
|
|
|
|
|
class ObjDumper {
|
|
|
|
public:
|
2016-05-03 08:28:04 +08:00
|
|
|
ObjDumper(ScopedPrinter &Writer);
|
2013-04-04 02:31:38 +08:00
|
|
|
virtual ~ObjDumper();
|
|
|
|
|
|
|
|
virtual void printFileHeaders() = 0;
|
|
|
|
virtual void printSections() = 0;
|
|
|
|
virtual void printRelocations() = 0;
|
|
|
|
virtual void printSymbols() = 0;
|
|
|
|
virtual void printDynamicSymbols() = 0;
|
|
|
|
virtual void printUnwindInfo() = 0;
|
|
|
|
|
|
|
|
// Only implemented for ELF at this time.
|
2015-06-26 05:47:32 +08:00
|
|
|
virtual void printDynamicRelocations() { }
|
2013-04-04 02:31:38 +08:00
|
|
|
virtual void printDynamicTable() { }
|
|
|
|
virtual void printNeededLibraries() { }
|
2013-04-12 12:07:39 +08:00
|
|
|
virtual void printProgramHeaders() { }
|
2015-07-10 06:32:24 +08:00
|
|
|
virtual void printHashTable() { }
|
2015-10-14 20:11:50 +08:00
|
|
|
virtual void printGnuHashTable() { }
|
2015-07-21 21:48:41 +08:00
|
|
|
virtual void printLoadName() {}
|
2015-10-17 07:19:01 +08:00
|
|
|
virtual void printVersionInfo() {}
|
2016-01-27 03:46:39 +08:00
|
|
|
virtual void printGroupSections() {}
|
2016-04-12 01:15:30 +08:00
|
|
|
virtual void printHashHistogram() {}
|
2016-08-31 02:52:02 +08:00
|
|
|
virtual void printNotes() {}
|
2013-04-04 02:31:38 +08:00
|
|
|
|
2014-01-30 12:46:33 +08:00
|
|
|
// Only implemented for ARM ELF at this time.
|
|
|
|
virtual void printAttributes() { }
|
|
|
|
|
2014-06-18 16:47:09 +08:00
|
|
|
// Only implemented for MIPS ELF at this time.
|
|
|
|
virtual void printMipsPLTGOT() { }
|
2015-05-07 23:40:35 +08:00
|
|
|
virtual void printMipsABIFlags() { }
|
2015-06-17 05:47:43 +08:00
|
|
|
virtual void printMipsReginfo() { }
|
2016-05-04 13:58:57 +08:00
|
|
|
virtual void printMipsOptions() { }
|
2014-06-18 16:47:09 +08:00
|
|
|
|
2016-12-15 01:16:52 +08:00
|
|
|
// Only implemented for AMDGPU ELF at this time.
|
2017-03-23 06:32:22 +08:00
|
|
|
virtual void printAMDGPUCodeObjectMetadata() {}
|
2016-12-15 01:16:52 +08:00
|
|
|
|
2014-10-03 01:02:18 +08:00
|
|
|
// Only implemented for PE/COFF.
|
|
|
|
virtual void printCOFFImports() { }
|
2015-01-04 05:35:09 +08:00
|
|
|
virtual void printCOFFExports() { }
|
2014-10-08 03:37:52 +08:00
|
|
|
virtual void printCOFFDirectives() { }
|
2014-11-19 08:18:07 +08:00
|
|
|
virtual void printCOFFBaseReloc() { }
|
2016-06-03 01:10:43 +08:00
|
|
|
virtual void printCOFFDebugDirectory() { }
|
2017-04-28 03:38:38 +08:00
|
|
|
virtual void printCOFFResources() {}
|
2017-06-22 09:10:29 +08:00
|
|
|
virtual void printCOFFLoadConfig() { }
|
2015-12-17 02:28:12 +08:00
|
|
|
virtual void printCodeViewDebugInfo() { }
|
2017-03-25 01:26:38 +08:00
|
|
|
virtual void mergeCodeViewTypes(llvm::codeview::TypeTableBuilder &CVIDs,
|
|
|
|
llvm::codeview::TypeTableBuilder &CVTypes) {}
|
2014-10-03 01:02:18 +08:00
|
|
|
|
2015-08-22 04:28:30 +08:00
|
|
|
// Only implemented for MachO.
|
|
|
|
virtual void printMachODataInCode() { }
|
2015-08-27 23:11:32 +08:00
|
|
|
virtual void printMachOVersionMin() { }
|
2015-09-01 03:32:31 +08:00
|
|
|
virtual void printMachODysymtab() { }
|
2015-09-03 00:24:24 +08:00
|
|
|
virtual void printMachOSegment() { }
|
2015-09-04 02:10:28 +08:00
|
|
|
virtual void printMachOIndirectSymbols() { }
|
2015-09-09 08:21:18 +08:00
|
|
|
virtual void printMachOLinkerOptions() { }
|
2015-08-22 04:28:30 +08:00
|
|
|
|
2015-06-27 07:56:53 +08:00
|
|
|
virtual void printStackMap() const = 0;
|
|
|
|
|
2013-04-04 02:31:38 +08:00
|
|
|
protected:
|
2016-05-03 08:28:04 +08:00
|
|
|
ScopedPrinter &W;
|
2013-04-04 02:31:38 +08:00
|
|
|
};
|
|
|
|
|
2014-06-13 09:25:41 +08:00
|
|
|
std::error_code createCOFFDumper(const object::ObjectFile *Obj,
|
2016-05-03 08:28:04 +08:00
|
|
|
ScopedPrinter &Writer,
|
2014-06-13 09:25:41 +08:00
|
|
|
std::unique_ptr<ObjDumper> &Result);
|
2013-04-04 02:31:38 +08:00
|
|
|
|
2014-06-13 09:25:41 +08:00
|
|
|
std::error_code createELFDumper(const object::ObjectFile *Obj,
|
2016-05-03 08:28:04 +08:00
|
|
|
ScopedPrinter &Writer,
|
2014-06-13 09:25:41 +08:00
|
|
|
std::unique_ptr<ObjDumper> &Result);
|
2013-04-04 02:31:38 +08:00
|
|
|
|
2014-06-13 09:25:41 +08:00
|
|
|
std::error_code createMachODumper(const object::ObjectFile *Obj,
|
2016-05-03 08:28:04 +08:00
|
|
|
ScopedPrinter &Writer,
|
2014-06-13 09:25:41 +08:00
|
|
|
std::unique_ptr<ObjDumper> &Result);
|
2013-04-04 02:31:38 +08:00
|
|
|
|
2017-01-31 07:30:52 +08:00
|
|
|
std::error_code createWasmDumper(const object::ObjectFile *Obj,
|
|
|
|
ScopedPrinter &Writer,
|
|
|
|
std::unique_ptr<ObjDumper> &Result);
|
|
|
|
|
2015-08-28 18:27:50 +08:00
|
|
|
void dumpCOFFImportFile(const object::COFFImportFile *File);
|
|
|
|
|
2016-05-14 08:02:53 +08:00
|
|
|
void dumpCodeViewMergedTypes(ScopedPrinter &Writer,
|
2017-03-25 01:26:38 +08:00
|
|
|
llvm::codeview::TypeTableBuilder &IDTable,
|
|
|
|
llvm::codeview::TypeTableBuilder &TypeTable);
|
2016-05-14 08:02:53 +08:00
|
|
|
|
2013-04-04 02:31:38 +08:00
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif
|