blob: 7adf76a694666e40b0f86b4df651a0c130f1c594 [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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_TOOLS_LLVM_READOBJ_OBJDUMPER_H
11#define LLVM_TOOLS_LLVM_READOBJ_OBJDUMPER_H
Eric Christopher9cad53c2013-04-03 18:31:38 +000012
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
Simon Atanasyan80433902014-06-18 08:47:09 +000043 // Only implemented for MIPS ELF at this time.
44 virtual void printMipsPLTGOT() { }
45
Eric Christopher9cad53c2013-04-03 18:31:38 +000046protected:
47 StreamWriter& W;
48};
49
Rafael Espindolabff5d0d2014-06-13 01:25:41 +000050std::error_code createCOFFDumper(const object::ObjectFile *Obj,
51 StreamWriter &Writer,
52 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000053
Rafael Espindolabff5d0d2014-06-13 01:25:41 +000054std::error_code createELFDumper(const object::ObjectFile *Obj,
55 StreamWriter &Writer,
56 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000057
Rafael Espindolabff5d0d2014-06-13 01:25:41 +000058std::error_code createMachODumper(const object::ObjectFile *Obj,
59 StreamWriter &Writer,
60 std::unique_ptr<ObjDumper> &Result);
Eric Christopher9cad53c2013-04-03 18:31:38 +000061
62} // namespace llvm
63
64#endif