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