OpenASIP
2.0
|
#include <TPEFDumper.hh>
Public Member Functions | |
TPEFDumper (TPEF::Binary &tpef, std::ostream &out) | |
virtual | ~TPEFDumper () |
void | setOnlyLogical (bool flag) |
bool | onlyLogical () const |
void | fileHeaders () |
void | sectionHeaders () |
void | memoryInfo () |
void | relocationTables () |
void | symbolTables () |
void | section (Word sectionIndex) |
Private Attributes | |
std::vector< Word > | actualIndexes_ |
TPEF::Binary & | tpef_ |
std::ostream & | out_ |
bool | onlyLogicalInfo_ |
Outputs TPEF hierarchy in textual form.
Definition at line 51 of file TPEFDumper.hh.
TPEFDumper::TPEFDumper | ( | TPEF::Binary & | tpef, |
std::ostream & | out | ||
) |
Constructor.
Definition at line 95 of file TPEFDumper.cc.
|
virtual |
|
private |
Converts index to print sections in logical order, if onlyLogical() is set.
Requested | index of section. |
Definition at line 137 of file TPEFDumper.cc.
References actualIndexes_, and onlyLogical().
Referenced by findSectionIndex(), memoryInfo(), relocationTables(), section(), sectionHeaders(), and symbolTables().
|
private |
Returns address space element in human readable form.
aSpace | Address space to convert. |
Definition at line 1320 of file TPEFDumper.cc.
References TPEF::ASpaceElement::align(), assert, findElementIndex(), TPEF::ASpaceSection::isUndefined(), TPEF::Section::link(), TPEF::ASpaceElement::MAU(), onlyLogical(), TPEF::Binary::section(), Conversion::toString(), tpef_, and TPEF::ASpaceElement::wordSize().
Referenced by section(), and sectionHeader().
|
private |
Organizes sections alphabetically and creates index table.
NOTE: method does not work if there is two sections with same header string (very rare).
Definition at line 112 of file TPEFDumper.cc.
References actualIndexes_, TPEF::Binary::section(), TPEF::Binary::sectionCount(), sectionHeader(), and tpef_.
Referenced by setOnlyLogical().
|
private |
Returns debug element type string in human readable form.
type | Type id to convert.convert. |
Definition at line 1135 of file TPEFDumper.cc.
Referenced by section().
|
private |
Dumps a set of strings to output stream.
Clears dumped set.
set | Set of strings to print. |
Definition at line 1385 of file TPEFDumper.cc.
References out_.
Referenced by section().
|
private |
Returns file architecture type in human readable form.
arch | Architecture id to convert. |
Definition at line 1113 of file TPEFDumper.cc.
References Conversion::toHexString().
Referenced by fileHeaders().
void TPEFDumper::fileHeaders | ( | ) |
Prints file headers.
Definition at line 181 of file TPEFDumper.cc.
References TPEF::Binary::arch(), fileArchString(), fileTypeString(), findSectionIndex(), out_, TPEF::Binary::sectionCount(), sectionString(), TPEF::Binary::strings(), Conversion::toString(), tpef_, and TPEF::Binary::type().
Referenced by main().
|
private |
Returns file type in human readable form.
type | File type id to convert. |
Definition at line 1154 of file TPEFDumper.cc.
References Conversion::toHexString().
Referenced by fileHeaders().
|
private |
Returns index of element.
If element is not found from section returns -1.
sect | Section which contains the element. |
elem | Element whose index is returned. |
Definition at line 1053 of file TPEFDumper.cc.
References TPEF::Section::element(), and TPEF::Section::elementCount().
Referenced by addressSpaceString(), and symbolString().
|
private |
Returns index of section.
If section is not found from tpef returns -1.
sect | Section whose index is returned. |
Definition at line 1023 of file TPEFDumper.cc.
References actualIndex(), TPEF::Binary::section(), TPEF::Binary::sectionCount(), and tpef_.
Referenced by fileHeaders(), sectionHeader(), and sectionString().
void TPEFDumper::memoryInfo | ( | ) |
Prints information about needed data address space sizes for initialized and uninitialized data.
Definition at line 232 of file TPEFDumper.cc.
References actualIndex(), TPEF::Section::aSpace(), assert, TPEF::Section::element(), TPEF::Section::elementCount(), TPEF::Section::isProgramSection(), out_, TPEF::Binary::section(), TPEF::Binary::sectionCount(), TPEF::Section::startingAddress(), tpef_, and TPEF::Section::type().
Referenced by main().
bool TPEFDumper::onlyLogical | ( | ) | const |
Returns true if dumper is set to print only logical information.
See. setOnlyLogical for more information.
Definition at line 173 of file TPEFDumper.cc.
References onlyLogicalInfo_.
Referenced by actualIndex(), addressSpaceString(), section(), and symbolString().
void TPEFDumper::relocationTables | ( | ) |
Prints full information of every relocation table in tpef.
Definition at line 321 of file TPEFDumper.cc.
References actualIndex(), section(), TPEF::Binary::section(), TPEF::Binary::sectionCount(), tpef_, and TPEF::Section::type().
Referenced by main().
|
private |
Returns srelocation type in human readable form.
type | Relocation type id to convert. |
Definition at line 1223 of file TPEFDumper.cc.
References Conversion::toHexString().
Referenced by section().
|
private |
Returns resource id in human readable form.
id | Resource id to convert. |
type | Resource type of id. (needed for conversion) |
Definition at line 1269 of file TPEFDumper.cc.
References Conversion::toHexString().
Referenced by section().
|
private |
Returns resource type in human readable form.
type | Resource type id to convert. |
Definition at line 1245 of file TPEFDumper.cc.
References Conversion::toHexString().
Referenced by section().
|
private |
Prints all information of requested section.
sect | Section to print. |
Definition at line 468 of file TPEFDumper.cc.
References abortWithError, TPEF::SymbolElement::absolute(), addressSpaceString(), TPEF::ASpaceElement::align(), TPEF::RelocElement::aSpace(), assert, TPEF::RawSection::belongsToSection(), TPEF::SymbolElement::binding(), TPEF::DataSection::byte(), TPEF::DebugElement::byte(), TPEF::StringSection::chunk2String(), TPEF::RawSection::chunkToMAUIndex(), TPEFDisassembler::createInstruction(), debugElementTypeString(), TPEF::DebugElement::debugString(), TPEF::RelocElement::destination(), dumpStringSet(), TPEF::Section::element(), TPEF::Section::elementCount(), TPEF::ResourceElement::id(), TPEF::CodeSection::indexOfElement(), TPEF::CodeSection::indexOfInstruction(), TPEF::ResourceElement::info(), TPEFDisassembler::instructionCount(), TPEF::DataSection::length(), TPEF::DebugElement::length(), TPEF::RawSection::lengthInMAUs(), TPEF::Section::link(), TPEF::RelocElement::location(), TPEF::ASpaceElement::MAU(), TPEF::DataSection::MAU(), TPEF::ASpaceElement::name(), TPEF::SymbolElement::name(), TPEF::ResourceElement::name(), onlyLogical(), out_, TPEF::DataSymElement::reference(), TPEF::CodeSymElement::reference(), TPEF::RelocSection::referencedSection(), relocTypeString(), resourceIdString(), resourceTypeString(), TPEF::SymbolElement::section(), sectionHeader(), sectionString(), sectionTypeString(), TPEF::RelocElement::size(), TPEFDisassembler::startAddress(), TPEF::Section::startingAddress(), TPEF::RelocElement::symbol(), symbolBindString(), symbolString(), symbolTypeString(), Conversion::toHexString(), Conversion::toString(), DisassemblyInstruction::toString(), tpef_, TPEF::DebugElement::type(), TPEF::RelocElement::type(), TPEF::SymbolElement::type(), TPEF::ResourceElement::type(), TPEF::Section::type(), and TPEF::ASpaceElement::wordSize().
void TPEFDumper::section | ( | Word | sectionIndex | ) |
Prints full information of one section in tpef.
sectionIndex | Index of requested section. |
Definition at line 353 of file TPEFDumper.cc.
References actualIndex(), out_, TPEF::Binary::section(), TPEF::Binary::sectionCount(), and tpef_.
Referenced by main(), relocationTables(), and symbolTables().
|
private |
Returns field names (first line of table) of section header table.
Definition at line 369 of file TPEFDumper.cc.
Referenced by createLogicalIndexes(), section(), and sectionHeaders().
|
private |
Returns section header string of one section.
sect | Section whose header is printed. |
Definition at line 391 of file TPEFDumper.cc.
References addressSpaceString(), TPEF::Section::aSpace(), TPEF::StringSection::chunk2String(), TPEF::Section::elementCount(), findSectionIndex(), TPEF::Section::flags(), TPEF::Section::isChunkable(), TPEF::Section::link(), TPEF::Section::name(), sectionString(), sectionTypeString(), TPEF::Section::startingAddress(), TPEF::Binary::strings(), Conversion::toHexString(), Conversion::toString(), tpef_, and TPEF::Section::type().
void TPEFDumper::sectionHeaders | ( | ) |
Prints one lined section header for every section.
Definition at line 210 of file TPEFDumper.cc.
References actualIndex(), out_, TPEF::Binary::section(), TPEF::Binary::sectionCount(), sectionHeader(), and tpef_.
Referenced by main().
|
private |
Returns section index and/or type information.
sect | Section whose string is requested. |
shortForm | If true then only index is returned. |
Definition at line 445 of file TPEFDumper.cc.
References findSectionIndex(), sectionTypeString(), Conversion::toString(), and TPEF::Section::type().
Referenced by fileHeaders(), section(), and sectionHeader().
|
private |
Returns section type in human readable form.
type | Type id to convert. |
shortForm | If short form (only enum string) is returned. |
Definition at line 1076 of file TPEFDumper.cc.
References Conversion::toHexString().
Referenced by section(), sectionHeader(), and sectionString().
void TPEFDumper::setOnlyLogical | ( | bool | flag | ) |
Sets if dumper is wanted to print out only logical information of TPEF.
If flag is set then no element or section indexes are dumped, only information that is independent to that how TPEF hierarchy is physically constructed is dumped. With this option user can check for example if two different TPEF files actually contains same program, relocations, symbols etc.
flag | If true, then logical printing is set on. |
Definition at line 157 of file TPEFDumper.cc.
References createLogicalIndexes(), and onlyLogicalInfo_.
Referenced by main().
|
private |
Returns symbol binding type in human readable form.
bind | Symbol binding type id to convert. |
Definition at line 1202 of file TPEFDumper.cc.
References Conversion::toHexString().
Referenced by section().
|
private |
Returns symbol in human readable form.
sect | Section containing requested symbol. |
sym | Symbol to convert. |
Definition at line 1360 of file TPEFDumper.cc.
References assert, TPEF::StringSection::chunk2String(), findElementIndex(), TPEF::Section::link(), TPEF::SymbolElement::name(), onlyLogical(), and Conversion::toString().
Referenced by section().
void TPEFDumper::symbolTables | ( | ) |
Prints full information of every symbol table in tpef.
Definition at line 336 of file TPEFDumper.cc.
References actualIndex(), section(), TPEF::Binary::section(), TPEF::Binary::sectionCount(), tpef_, and TPEF::Section::type().
Referenced by main().
|
private |
Returns symbol type in human readable form.
type | Symbol type id to convert. |
Definition at line 1178 of file TPEFDumper.cc.
References Conversion::toHexString().
Referenced by section().
|
private |
Definition at line 104 of file TPEFDumper.hh.
Referenced by actualIndex(), and createLogicalIndexes().
|
private |
Definition at line 109 of file TPEFDumper.hh.
Referenced by onlyLogical(), and setOnlyLogical().
|
private |
Definition at line 107 of file TPEFDumper.hh.
Referenced by dumpStringSet(), fileHeaders(), memoryInfo(), section(), and sectionHeaders().
|
private |
Definition at line 106 of file TPEFDumper.hh.
Referenced by addressSpaceString(), createLogicalIndexes(), fileHeaders(), findSectionIndex(), memoryInfo(), relocationTables(), section(), sectionHeader(), sectionHeaders(), and symbolTables().