1//===-- ObjDumper.h -------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef LLVM_READOBJ_OBJDUMPER_H 11#define LLVM_READOBJ_OBJDUMPER_H 12 13#include <memory> 14#include <system_error> 15 16namespace llvm { 17namespace object { 18 class ObjectFile; 19} 20 21class StreamWriter; 22 23class ObjDumper { 24public: 25 ObjDumper(StreamWriter& Writer); 26 virtual ~ObjDumper(); 27 28 virtual void printFileHeaders() = 0; 29 virtual void printSections() = 0; 30 virtual void printRelocations() = 0; 31 virtual void printSymbols() = 0; 32 virtual void printDynamicSymbols() = 0; 33 virtual void printUnwindInfo() = 0; 34 35 // Only implemented for ELF at this time. 36 virtual void printDynamicTable() { } 37 virtual void printNeededLibraries() { } 38 virtual void printProgramHeaders() { } 39 40 // Only implemented for ARM ELF at this time. 41 virtual void printAttributes() { } 42 43 // Only implemented for MIPS ELF at this time. 44 virtual void printMipsPLTGOT() { } 45 46protected: 47 StreamWriter& W; 48}; 49 50std::error_code createCOFFDumper(const object::ObjectFile *Obj, 51 StreamWriter &Writer, 52 std::unique_ptr<ObjDumper> &Result); 53 54std::error_code createELFDumper(const object::ObjectFile *Obj, 55 StreamWriter &Writer, 56 std::unique_ptr<ObjDumper> &Result); 57 58std::error_code createMachODumper(const object::ObjectFile *Obj, 59 StreamWriter &Writer, 60 std::unique_ptr<ObjDumper> &Result); 61 62} // namespace llvm 63 64#endif 65