OpenASIP
2.0
|
#include <TPEFReader.hh>
Public Member Functions | |
Section * | sectionOfAddress (const ASpaceElement *aSpaceId, AddressImage address) const |
SectionId | aSpaceId () |
SectionId | strTableId () |
void | addSectionSize (const Section *sect, Word length) |
ASpaceSection * | aSpaceSection () const |
Public Member Functions inherited from TPEF::BinaryReader | |
virtual | ~BinaryReader () |
Static Public Member Functions | |
static BinaryReader * | instance () |
Static Public Member Functions inherited from TPEF::BinaryReader | |
static Binary * | readBinary (BinaryStream &stream) |
Protected Member Functions | |
TPEFReader (const TPEFReader &) | |
TPEFReader & | operator= (const TPEFReader &) |
TPEFReader () | |
virtual | ~TPEFReader () |
virtual Binary * | readData (BinaryStream &stream) const |
virtual bool | isMyStreamType (BinaryStream &stream) const |
Protected Member Functions inherited from TPEF::BinaryReader | |
BinaryReader () | |
Private Member Functions | |
Section * | readSection (BinaryStream &stream, FileOffset headerOffset, Byte stringTableId, Byte aSpaceSectionId) const |
Private Attributes | |
Binary * | binary_ |
Last or currently read binary. More... | |
SectionId | aSpaceId_ |
Identification code of address space section (there is only one at maximum). More... | |
SectionId | strTableId_ |
Identification code of string table containing section name strings. More... | |
std::map< const Section *, Word > | sectionSizes_ |
Cache of sizes in addresses of read sections. More... | |
Static Private Attributes | |
static TPEFReader * | proto_ = NULL |
Prototype instance registered into BinaryReader. More... | |
Additional Inherited Members | |
Public Types inherited from TPEF::BinaryReader | |
typedef unsigned long | Length |
Static Protected Member Functions inherited from TPEF::BinaryReader | |
static void | registerBinaryReader (BinaryReader *reader) |
Reads binary file that is in TPEF binary format.
Definition at line 52 of file TPEFReader.hh.
|
protected |
|
protected |
Constructor.
Creates Header and registers itself to BinaryReader.
Definition at line 66 of file TPEFReader.cc.
References TPEF::BinaryReader::registerBinaryReader().
Referenced by instance().
|
protectedvirtual |
void TPEF::TPEFReader::addSectionSize | ( | const Section * | sect, |
Word | length | ||
) |
Stores size of a section as bytes.
Definition at line 320 of file TPEFReader.cc.
References sectionSizes_.
SectionId TPEF::TPEFReader::aSpaceId | ( | ) |
Returns the identification code of the address space table section.
Definition at line 330 of file TPEFReader.cc.
References aSpaceId_.
Referenced by TPEF::TPEFSectionReader::readData().
ASpaceSection * TPEF::TPEFReader::aSpaceSection | ( | ) | const |
Returns address space of file if already read.
Definition at line 351 of file TPEFReader.cc.
References binary_, TPEF::Binary::section(), TPEF::Binary::sectionCount(), TPEF::Section::ST_ADDRSP, and TPEF::Section::type().
Referenced by TPEF::TPEFRelocSectionReader::finalize().
|
static |
Returns instance of reader.
Definition at line 262 of file TPEFReader.cc.
References proto_, and TPEFReader().
Referenced by TPEF::TPEFSectionReader::parent().
|
protectedvirtual |
Checks if this reader is capable of reading the given stream.
This method does not modify the stream pointer.
stream | The stream to test. |
UnreachableStream | If there occurs an exception with stream. |
Implements TPEF::BinaryReader.
Definition at line 231 of file TPEFReader.cc.
References TPEF::BinaryStream::readByte(), TPEF::BinaryStream::readPosition(), and TPEF::BinaryStream::setReadPosition().
|
protected |
|
protectedvirtual |
Does the actual work of reading binary file from stream.
stream | Stream to be read from. |
UnreachableStream | If reading of section fails. |
KeyAlreadyExists | Key was in use whent rying to register object. |
EndOfFile | If end of file were reached while it shouldn't. |
OutOfRange | Some of read values were out of range. |
WrongSubclass | Some class couldn't do what it was asked for. |
UnexpectedValue | If there was unexpected value when reading. |
Implements TPEF::BinaryReader.
Definition at line 94 of file TPEFReader.cc.
References TPEF::ReferenceManager::SafePointer::addObjectReference(), TPEF::Binary::addSection(), aSpaceId_, assert, binary_, TPEF::Section::createSection(), TPEF::TPEFHeaders::FH_ARCH, TPEF::TPEFHeaders::FH_ID, TPEF::TPEFHeaders::FH_ID_SIZE, TPEF::TPEFHeaders::FH_SHNUM, TPEF::TPEFHeaders::FH_SHOFF, TPEF::TPEFHeaders::FH_SHSIZE, TPEF::TPEFHeaders::FH_SHSTRTAB, TPEF::TPEFHeaders::FH_TYPE, TPEF::Section::isProgramSection(), TPEF::ReferenceManager::SafePointer::null, proto_, TPEF::BinaryStream::readByte(), TPEF::BinaryStream::readHalfWord(), TPEF::BinaryStream::readPosition(), TPEF::SectionReader::readSection(), TPEF::BinaryStream::readWord(), TPEF::Binary::sectionCount(), sectionSizes_, TPEF::Binary::setArch(), TPEF::BinaryStream::setReadPosition(), TPEF::Binary::setStrings(), TPEF::BinaryStream::setTPEFVersion(), TPEF::Binary::setTPEFVersion(), TPEF::Binary::setType(), TPEF::TPEFHeaders::SH_ID, TPEF::TPEFHeaders::SH_TYPE, TPEF::Section::ST_ADDRSP, TPEF::Section::ST_MR, TPEF::Section::ST_NULL, and strTableId_.
|
private |
Section * TPEF::TPEFReader::sectionOfAddress | ( | const ASpaceElement * | aSpace, |
AddressImage | address | ||
) | const |
Resolves, which section is in given address in last read binary file.
aSpace | Address space in which section resides in memory image. |
address | Address whose section is resolved. |
Definition at line 277 of file TPEFReader.cc.
References TPEF::Section::aSpace(), assert, binary_, TPEF::Section::isCodeSection(), TPEF::Binary::section(), TPEF::Binary::sectionCount(), and TPEF::Section::startingAddress().
Referenced by TPEF::TPEFRelocSectionReader::finalize().
SectionId TPEF::TPEFReader::strTableId | ( | ) |
Returns the identification code of string table section that contains the names of the sections.
Definition at line 341 of file TPEFReader.cc.
References strTableId_.
Referenced by TPEF::TPEFSectionReader::readData().
|
mutableprivate |
Identification code of address space section (there is only one at maximum).
Definition at line 93 of file TPEFReader.hh.
Referenced by aSpaceId(), and readData().
|
mutableprivate |
Last or currently read binary.
Definition at line 90 of file TPEFReader.hh.
Referenced by aSpaceSection(), readData(), and sectionOfAddress().
|
staticprivate |
Prototype instance registered into BinaryReader.
Definition at line 87 of file TPEFReader.hh.
Referenced by instance(), readData(), and ~TPEFReader().
|
mutableprivate |
Cache of sizes in addresses of read sections.
Definition at line 97 of file TPEFReader.hh.
Referenced by addSectionSize(), and readData().
|
mutableprivate |
Identification code of string table containing section name strings.
Definition at line 95 of file TPEFReader.hh.
Referenced by readData(), and strTableId().