0c7eb5109f8f968142fa526ce381134cecb9ba1e
[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 "llvm/Support/system_error.h"
14
15 #include <memory>
16
17 namespace llvm {
18
19 namespace object {
20   class ObjectFile;
21 }
22
23 class StreamWriter;
24
25 class ObjDumper {
26 public:
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
45 protected:
46   StreamWriter& W;
47 };
48
49 error_code createCOFFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
50                             std::unique_ptr<ObjDumper> &Result);
51
52 error_code createELFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
53                            std::unique_ptr<ObjDumper> &Result);
54
55 error_code createMachODumper(const object::ObjectFile *Obj,
56                              StreamWriter &Writer,
57                              std::unique_ptr<ObjDumper> &Result);
58
59 } // namespace llvm
60
61 #endif