ObjDumper.h revision 36b56886974eae4f9c5ebc96befd3e7bfe5de338
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 15namespace llvm { 16 17namespace object { 18 class ObjectFile; 19} 20 21class error_code; 22 23class StreamWriter; 24 25class ObjDumper { 26public: 27 ObjDumper(StreamWriter& Writer); 28 virtual ~ObjDumper(); 29 30 virtual void printFileHeaders() = 0; 31 virtual void printSections() = 0; 32 virtual void printRelocations() = 0; 33 virtual void printSymbols() = 0; 34 virtual void printDynamicSymbols() = 0; 35 virtual void printUnwindInfo() = 0; 36 37 // Only implemented for ELF at this time. 38 virtual void printDynamicTable() { } 39 virtual void printNeededLibraries() { } 40 virtual void printProgramHeaders() { } 41 42 // Only implemented for ARM ELF at this time. 43 virtual void printAttributes() { } 44 45protected: 46 StreamWriter& W; 47}; 48 49error_code createCOFFDumper(const object::ObjectFile *Obj, StreamWriter &Writer, 50 std::unique_ptr<ObjDumper> &Result); 51 52error_code createELFDumper(const object::ObjectFile *Obj, StreamWriter &Writer, 53 std::unique_ptr<ObjDumper> &Result); 54 55error_code createMachODumper(const object::ObjectFile *Obj, 56 StreamWriter &Writer, 57 std::unique_ptr<ObjDumper> &Result); 58 59} // namespace llvm 60 61#endif 62