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