blob: 9e0fd2f990a412c1e07caf32bc0d38084f21561d [file] [log] [blame]
Eric Christopher9cad53c2013-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
Ahmed Charles56440fd2014-03-06 05:51:42 +000013#include <memory>
14
Eric Christopher9cad53c2013-04-03 18:31:38 +000015namespace llvm {
16
17namespace object {
18 class ObjectFile;
19}
20
21class error_code;
22
Eric Christopher9cad53c2013-04-03 18:31:38 +000023class StreamWriter;
24
25class ObjDumper {
26public:
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() { }
Nico Rieckd6df0542013-04-12 04:07:39 +000040 virtual void printProgramHeaders() { }
Eric Christopher9cad53c2013-04-03 18:31:38 +000041
Saleem Abdulrasool15d16d82014-01-30 04:46:33 +000042 // Only implemented for ARM ELF at this time.
43 virtual void printAttributes() { }
44
Eric Christopher9cad53c2013-04-03 18:31:38 +000045protected:
46 StreamWriter& W;
47};
48
Ahmed Charles56440fd2014-03-06 05:51:42 +000049error_code createCOFFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
50 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000051
Ahmed Charles56440fd2014-03-06 05:51:42 +000052error_code createELFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
53 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000054
55error_code createMachODumper(const object::ObjectFile *Obj,
Ahmed Charles56440fd2014-03-06 05:51:42 +000056 StreamWriter &Writer,
57 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000058
59} // namespace llvm
60
61#endif