blob: 6918e28cb93a7176bfbe789eac707bd0499600f9 [file] [log] [blame]
Eric Christopher76e70f32013-04-03 18:31:38 +00001//===-- 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() { }
Nico Rieckcf3b55a2013-04-12 04:07:39 +000041 virtual void printProgramHeaders() { }
Eric Christopher76e70f32013-04-03 18:31:38 +000042
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