Implements low-level object file format specific output for COFF and
[oota-llvm.git] / tools / llvm-readobj / ObjDumper.h
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 namespace llvm {
14
15 namespace object {
16   class ObjectFile;
17 }
18
19 class error_code;
20
21 template<typename T>
22 class OwningPtr;
23
24 class StreamWriter;
25
26 class ObjDumper {
27 public:
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
42 protected:
43   StreamWriter& W;
44 };
45
46 error_code createCOFFDumper(const object::ObjectFile *Obj,
47                             StreamWriter& Writer,
48                             OwningPtr<ObjDumper> &Result);
49
50 error_code createELFDumper(const object::ObjectFile *Obj,
51                            StreamWriter& Writer,
52                            OwningPtr<ObjDumper> &Result);
53
54 error_code createMachODumper(const object::ObjectFile *Obj,
55                              StreamWriter& Writer,
56                              OwningPtr<ObjDumper> &Result);
57
58 } // namespace llvm
59
60 #endif