52using ReferenceManager::SafePointer;
54using ReferenceManager::FileOffsetKey;
55using ReferenceManager::SectionOffsetKey;
56using ReferenceManager::SectionKey;
57using ReferenceManager::SectionIndexKey;
136 Word stringTableFileOffset = stream.
readWord();
138 if (stringTableFileOffset != 0) {
146 if (stringTableFileOffset != 0) {
156 bool programSectionWasFound =
false;
157 for (Word i = offsetToHeader;
158 i < offsetToHeader + (sectionHeaderCount*sectionHeaderSize);
159 i += sectionHeaderSize) {
169 bool brokenBinaryMoreThanOneASpaceSection =
170 (aSpaceSectionId == 0);
171 assert(brokenBinaryMoreThanOneASpaceSection);
177 programSectionWasFound =
true;
182 assert(aSpaceSectionId != 0);
186 for (HalfWord i = 0; i < sectionHeaderCount; i++) {
201 offsetToHeader += sectionHeaderSize;
216 programSectionWasFound ==
false));
288 if (sect->
aSpace() == aSpace) {
293 lastSectionAddress +=
294 dynamic_cast<CodeSection*
>(sect)->instructionCount();
297 lastSectionAddress +=
298 dynamic_cast<RawSection*
>(sect)->lengthInMAUs();
302 if (address < lastSectionAddress &&
#define assert(condition)
UInt32 AddressImage
Type for storing addresses to memory image.
static void registerBinaryReader(BinaryReader *reader)
void setReadPosition(unsigned int position)
unsigned int readPosition()
void setTPEFVersion(TPEFHeaders::TPEFVersion version)
void addSection(Section *section)
void setArch(FileArchitecture arch)
Word sectionCount() const
Section * section(Word index) const
void setType(FileType type)
void setTPEFVersion(TPEFHeaders::TPEFVersion version)
void setStrings(StringSection *strTable)
static void addObjectReference(SectionIndexKey key, const SafePointable *obj)
static const SafePointer null
The default SafePointer that is used in null references.
static void readSection(BinaryStream &stream, Section *section, BinaryReader *reader)
static Section * createSection(SectionType type)
AddressImage startingAddress() const
bool isProgramSection() const
@ ST_ADDRSP
Address space section.
@ ST_MR
Machine resources section.
virtual bool isCodeSection() const
virtual SectionType type() const =0
Returns SectioType of actual section instance.
ASpaceElement * aSpace() const
void addSectionSize(const Section *sect, Word length)
virtual bool isMyStreamType(BinaryStream &stream) const
Binary * binary_
Last or currently read binary.
std::map< const Section *, Word > sectionSizes_
Cache of sizes in addresses of read sections.
ASpaceSection * aSpaceSection() const
SectionId aSpaceId_
Identification code of address space section (there is only one at maximum).
static TPEFReader * proto_
Prototype instance registered into BinaryReader.
SectionId strTableId_
Identification code of string table containing section name strings.
virtual Binary * readData(BinaryStream &stream) const
static BinaryReader * instance()
Section * sectionOfAddress(const ASpaceElement *aSpaceId, AddressImage address) const
HalfWord SectionId
Type for storing binary file section ids.
Word FileOffset
Type for storing absolute file offsets.