LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ObjectImageCommon.h
Go to the documentation of this file.
1 //===-- ObjectImageCommon.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_RUNTIMEDYLD_OBJECTIMAGECOMMON_H
15 #define LLVM_RUNTIMEDYLD_OBJECTIMAGECOMMON_H
16 
19 #include "llvm/Object/ObjectFile.h"
20 
21 namespace llvm {
22 
24  ObjectImageCommon(); // = delete
25  ObjectImageCommon(const ObjectImageCommon &other); // = delete
26  virtual void anchor();
27 
28 protected:
30 
31  // This form of the constructor allows subclasses to use
32  // format-specific subclasses of ObjectFile directly
34  : ObjectImage(Input), // saves Input as Buffer and takes ownership
35  ObjFile(Obj)
36  {
37  }
38 
39 public:
41  : ObjectImage(Input) // saves Input as Buffer and takes ownership
42  {
44  }
45  virtual ~ObjectImageCommon() { delete ObjFile; }
46 
48  { return ObjFile->begin_symbols(); }
50  { return ObjFile->end_symbols(); }
51 
53  { return ObjFile->begin_sections(); }
55  { return ObjFile->end_sections(); }
56 
57  virtual /* Triple::ArchType */ unsigned getArch() const
58  { return ObjFile->getArch(); }
59 
60  virtual StringRef getData() const { return ObjFile->getData(); }
61 
62  virtual object::ObjectFile* getObjectFile() const { return ObjFile; }
63 
64  // Subclasses can override these methods to update the image with loaded
65  // addresses for sections and common symbols
66  virtual void updateSectionAddress(const object::SectionRef &Sec,
67  uint64_t Addr) {}
68  virtual void updateSymbolAddress(const object::SymbolRef &Sym, uint64_t Addr)
69  {}
70 
71  // Subclasses can override these methods to provide JIT debugging support
72  virtual void registerWithDebugger() {}
73  virtual void deregisterWithDebugger() {}
74 };
75 
76 } // end namespace llvm
77 
78 #endif // LLVM_RUNTIMEDYLD_OBJECT_IMAGE_H
79 
OwningPtr< ObjectBuffer > Buffer
Definition: ObjectImage.h:31
virtual unsigned getArch() const =0
object::ObjectFile * ObjFile
virtual void updateSectionAddress(const object::SectionRef &Sec, uint64_t Addr)
StringRef getData() const
Definition: Binary.cpp:37
virtual section_iterator end_sections() const =0
static ObjectFile * createObjectFile(StringRef ObjectPath)
Create ObjectFile from path.
Definition: ObjectFile.cpp:79
virtual object::ObjectFile * getObjectFile() const
virtual object::symbol_iterator begin_symbols() const
virtual void deregisterWithDebugger()
ObjectImageCommon(ObjectBuffer *Input, object::ObjectFile *Obj)
virtual section_iterator begin_sections() const =0
virtual symbol_iterator end_symbols() const =0
virtual void updateSymbolAddress(const object::SymbolRef &Sym, uint64_t Addr)
virtual object::symbol_iterator end_symbols() const
virtual unsigned getArch() const
virtual void registerWithDebugger()
virtual object::section_iterator begin_sections() const
ObjectImageCommon(ObjectBuffer *Input)
virtual symbol_iterator begin_symbols() const =0
virtual StringRef getData() const
virtual object::section_iterator end_sections() const