blob: 795193327bc5c77cdc73dd025d82065b49859304 [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 {
Eric Christopher9cad53c2013-04-03 18:31:38 +000017namespace object {
18 class ObjectFile;
19}
20
Eric Christopher9cad53c2013-04-03 18:31:38 +000021class StreamWriter;
22
23class ObjDumper {
24public:
25 ObjDumper(StreamWriter& Writer);
26 virtual ~ObjDumper();
27
28 virtual void printFileHeaders() = 0;
29 virtual void printSections() = 0;
30 virtual void printRelocations() = 0;
31 virtual void printSymbols() = 0;
32 virtual void printDynamicSymbols() = 0;
33 virtual void printUnwindInfo() = 0;
34
35 // Only implemented for ELF at this time.
36 virtual void printDynamicTable() { }
37 virtual void printNeededLibraries() { }
Nico Rieckd6df0542013-04-12 04:07:39 +000038 virtual void printProgramHeaders() { }
Eric Christopher9cad53c2013-04-03 18:31:38 +000039
Saleem Abdulrasool15d16d82014-01-30 04:46:33 +000040 // Only implemented for ARM ELF at this time.
41 virtual void printAttributes() { }
42
Eric Christopher9cad53c2013-04-03 18:31:38 +000043protected:
44 StreamWriter& W;
45};
46
Rafael Espindolabff5d0d2014-06-13 01:25:41 +000047std::error_code createCOFFDumper(const object::ObjectFile *Obj,
48 StreamWriter &Writer,
49 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000050
Rafael Espindolabff5d0d2014-06-13 01:25:41 +000051std::error_code createELFDumper(const object::ObjectFile *Obj,
52 StreamWriter &Writer,
53 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000054
Rafael Espindolabff5d0d2014-06-13 01:25:41 +000055std::error_code createMachODumper(const object::ObjectFile *Obj,
56 StreamWriter &Writer,
57 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000058
59} // namespace llvm
60
61#endif