blob: 3e8194bffed0da73740262f9553bdcd03c0ab947 [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>
Rafael Espindolaa6e9c3e2014-06-12 17:38:55 +000014#include <system_error>
Ahmed Charles56440fd2014-03-06 05:51:42 +000015
Eric Christopher9cad53c2013-04-03 18:31:38 +000016namespace llvm {
Rafael Espindolaa6e9c3e2014-06-12 17:38:55 +000017using std::error_code;
Eric Christopher9cad53c2013-04-03 18:31:38 +000018namespace object {
19 class ObjectFile;
20}
21
Eric Christopher9cad53c2013-04-03 18:31:38 +000022class StreamWriter;
23
24class ObjDumper {
25public:
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() { }
Nico Rieckd6df0542013-04-12 04:07:39 +000039 virtual void printProgramHeaders() { }
Eric Christopher9cad53c2013-04-03 18:31:38 +000040
Saleem Abdulrasool15d16d82014-01-30 04:46:33 +000041 // Only implemented for ARM ELF at this time.
42 virtual void printAttributes() { }
43
Eric Christopher9cad53c2013-04-03 18:31:38 +000044protected:
45 StreamWriter& W;
46};
47
Ahmed Charles56440fd2014-03-06 05:51:42 +000048error_code createCOFFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
49 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000050
Ahmed Charles56440fd2014-03-06 05:51:42 +000051error_code createELFDumper(const object::ObjectFile *Obj, StreamWriter &Writer,
52 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000053
54error_code createMachODumper(const object::ObjectFile *Obj,
Ahmed Charles56440fd2014-03-06 05:51:42 +000055 StreamWriter &Writer,
56 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000057
58} // namespace llvm
59
60#endif