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