176e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher//===-- ObjDumper.h -------------------------------------------------------===//
276e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher//
376e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher//                     The LLVM Compiler Infrastructure
476e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher//
576e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher// This file is distributed under the University of Illinois Open Source
676e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher// License. See LICENSE.TXT for details.
776e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher//
876e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher//===----------------------------------------------------------------------===//
976e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
1076e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher#ifndef LLVM_READOBJ_OBJDUMPER_H
1176e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher#define LLVM_READOBJ_OBJDUMPER_H
1276e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
1376e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christophernamespace llvm {
1476e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
1576e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christophernamespace object {
1676e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  class ObjectFile;
1776e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher}
1876e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
1976e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopherclass error_code;
2076e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
2176e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christophertemplate<typename T>
2276e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopherclass OwningPtr;
2376e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
2476e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopherclass StreamWriter;
2576e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
2676e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopherclass ObjDumper {
2776e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopherpublic:
2876e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  ObjDumper(StreamWriter& Writer);
2976e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual ~ObjDumper();
3076e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
3176e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual void printFileHeaders() = 0;
3276e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual void printSections() = 0;
3376e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual void printRelocations() = 0;
3476e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual void printSymbols() = 0;
3576e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual void printDynamicSymbols() = 0;
3676e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual void printUnwindInfo() = 0;
3776e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
3876e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  // Only implemented for ELF at this time.
3976e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual void printDynamicTable() { }
4076e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  virtual void printNeededLibraries() { }
41cf3b55ab18b6d0f5b658e746b57ec3cf193d5688Nico Rieck  virtual void printProgramHeaders() { }
4276e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
4376e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopherprotected:
4476e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher  StreamWriter& W;
4576e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher};
4676e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
4776e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christophererror_code createCOFFDumper(const object::ObjectFile *Obj,
4876e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher                            StreamWriter& Writer,
4976e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher                            OwningPtr<ObjDumper> &Result);
5076e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
5176e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christophererror_code createELFDumper(const object::ObjectFile *Obj,
5276e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher                           StreamWriter& Writer,
5376e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher                           OwningPtr<ObjDumper> &Result);
5476e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
5576e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christophererror_code createMachODumper(const object::ObjectFile *Obj,
5676e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher                             StreamWriter& Writer,
5776e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher                             OwningPtr<ObjDumper> &Result);
5876e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
5976e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher} // namespace llvm
6076e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher
6176e70f340c09ba759ad96d8dfe416b64f24bc287Eric Christopher#endif
62