1//===---- ObjectImage.h - Format independent executuable object image -----===// 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// This file declares a file format independent ObjectImage class. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef LLVM_EXECUTIONENGINE_OBJECTIMAGE_H 15#define LLVM_EXECUTIONENGINE_OBJECTIMAGE_H 16 17#include "llvm/ExecutionEngine/ObjectBuffer.h" 18#include "llvm/Object/ObjectFile.h" 19 20namespace llvm { 21 22 23/// ObjectImage - A container class that represents an ObjectFile that has been 24/// or is in the process of being loaded into memory for execution. 25class ObjectImage { 26 ObjectImage() LLVM_DELETED_FUNCTION; 27 ObjectImage(const ObjectImage &other) LLVM_DELETED_FUNCTION; 28 29protected: 30 OwningPtr<ObjectBuffer> Buffer; 31 32public: 33 ObjectImage(ObjectBuffer *Input) : Buffer(Input) {} 34 virtual ~ObjectImage() {} 35 36 virtual object::symbol_iterator begin_symbols() const = 0; 37 virtual object::symbol_iterator end_symbols() const = 0; 38 39 virtual object::section_iterator begin_sections() const = 0; 40 virtual object::section_iterator end_sections() const = 0; 41 42 virtual /* Triple::ArchType */ unsigned getArch() const = 0; 43 44 // Subclasses can override these methods to update the image with loaded 45 // addresses for sections and common symbols 46 virtual void updateSectionAddress(const object::SectionRef &Sec, 47 uint64_t Addr) = 0; 48 virtual void updateSymbolAddress(const object::SymbolRef &Sym, 49 uint64_t Addr) = 0; 50 51 virtual StringRef getData() const = 0; 52 53 virtual object::ObjectFile* getObjectFile() const = 0; 54 55 // Subclasses can override these methods to provide JIT debugging support 56 virtual void registerWithDebugger() = 0; 57 virtual void deregisterWithDebugger() = 0; 58}; 59 60} // end namespace llvm 61 62#endif // LLVM_EXECUTIONENGINE_OBJECTIMAGE_H 63 64