1 /* 2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef IMAGE_H 6 #define IMAGE_H 7 8 #include "SharedImage.h" 9 10 11 class Image : public Referenceable { 12 public: 13 Image(SharedImage* image, 14 const image_info& info, team_id owner, 15 int32 creationEvent); 16 ~Image(); 17 18 inline SharedImage* GetSharedImage() const { return fImage; } 19 20 inline const image_id ID() const; 21 inline const char* Name() const; 22 inline team_id Owner() const; 23 inline addr_t LoadDelta() const { return fLoadDelta; } 24 25 inline int32 CreationEvent() const; 26 inline int32 DeletionEvent() const; 27 inline void SetDeletionEvent(int32 event); 28 29 inline Symbol** Symbols() const; 30 inline int32 SymbolCount() const; 31 32 inline bool ContainsAddress(addr_t address) const; 33 inline int32 FindSymbol(addr_t address) const; 34 35 private: 36 SharedImage* fImage; 37 image_id fID; 38 team_id fOwner; 39 addr_t fLoadDelta; 40 int32 fCreationEvent; 41 int32 fDeletionEvent; 42 }; 43 44 45 // #pragma mark - 46 47 48 const image_id 49 Image::ID() const 50 { 51 return fID; 52 } 53 54 55 const char* 56 Image::Name() const 57 { 58 return fImage->Name(); 59 } 60 61 62 team_id 63 Image::Owner() const 64 { 65 return fOwner; 66 } 67 68 69 int32 70 Image::CreationEvent() const 71 { 72 return fCreationEvent; 73 } 74 75 76 int32 77 Image::DeletionEvent() const 78 { 79 return fDeletionEvent; 80 } 81 82 83 void 84 Image::SetDeletionEvent(int32 event) 85 { 86 fDeletionEvent = event; 87 } 88 89 90 Symbol** 91 Image::Symbols() const 92 { 93 return fImage->Symbols(); 94 } 95 96 97 int32 98 Image::SymbolCount() const 99 { 100 return fImage->SymbolCount(); 101 } 102 103 104 bool 105 Image::ContainsAddress(addr_t address) const 106 { 107 return fImage->ContainsAddress(address - fLoadDelta); 108 } 109 110 111 int32 112 Image::FindSymbol(addr_t address) const 113 { 114 return fImage->FindSymbol(address - fLoadDelta); 115 } 116 117 118 #endif // IMAGE_H 119