• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
printDynamicTable()39   virtual void printDynamicTable() { }
printNeededLibraries()40   virtual void printNeededLibraries() { }
printProgramHeaders()41   virtual void printProgramHeaders() { }
42 
43 protected:
44   StreamWriter& W;
45 };
46 
47 error_code createCOFFDumper(const object::ObjectFile *Obj,
48                             StreamWriter& Writer,
49                             OwningPtr<ObjDumper> &Result);
50 
51 error_code createELFDumper(const object::ObjectFile *Obj,
52                            StreamWriter& Writer,
53                            OwningPtr<ObjDumper> &Result);
54 
55 error_code createMachODumper(const object::ObjectFile *Obj,
56                              StreamWriter& Writer,
57                              OwningPtr<ObjDumper> &Result);
58 
59 } // namespace llvm
60 
61 #endif
62