Otawa
0.10
|
In usual file format like ELF, COFF and so on, the program file is divided in segment according platform needs or memory propertes. More...
#include <otawa/prog/Segment.h>
Classes | |
class | ItemIter |
Public Types | |
typedef t::uint32 | flags_t |
Public Member Functions | |
Segment (CString name, address_t address, ot::size size, flags_t flags) | |
Build a segment with the given information. More... | |
CString | name (void) const |
Get tne name of the segment. More... | |
flags_t | flags (void) const |
Get flag information about the segment. More... | |
bool | isExecutable (void) const |
Test if the segment is executable. More... | |
bool | isWritable (void) const |
Test if the segment is writable. More... | |
bool | isInitialized (void) const |
Test if the segment is initialized. More... | |
address_t | address (void) const |
Get the base address of the segment. More... | |
ot::size | size (void) const |
Get the size of the segment. More... | |
address_t | topAddress (void) const |
ProgItem * | findItemAt (const Address &addr) |
Find an item by its address. More... | |
Inst * | findInstAt (const Address &addr) |
Find an instruction by its address. More... | |
bool | contains (const Address &addr) const |
Property * | getProp (const AbstractIdentifier *id) const |
Find a property by its identifier. More... | |
void | setProp (Property *prop) |
Set the property in the property list removing any double. More... | |
void | setProp (const AbstractIdentifier *id) |
void | removeProp (const AbstractIdentifier *id) |
Remove a property matching the given identifier. More... | |
void | removeProp (const AbstractIdentifier &id) |
Property * | extractProp (const AbstractIdentifier *id) |
Remove a property matching the given identifier and return it. More... | |
Property * | extractProp (const AbstractIdentifier &id) |
Remove a property matching the given identifier and return it. More... | |
void | addProp (Property *prop) |
Add property to the list without checking of duplication. More... | |
void | removeAllProp (const AbstractIdentifier *id) |
Remove all the properties matching the given identifier. More... | |
bool | hasProp (const AbstractIdentifier &id) const |
Test if the property list contains a property matching the given identifier. More... | |
void | clearProps (void) |
Remove all properties from the list. More... | |
void | addProps (const PropList &props) |
Add all properties from the given property list, in a reverse order. More... | |
void | print (elm::io::Output &out) const |
Display the current property list. More... | |
Static Public Attributes | |
static const flags_t | EXECUTABLE = 0x01 |
Segment flags denoting an executable segment. More... | |
static const flags_t | WRITABLE = 0x02 |
Segment flags denoting a writable segment. More... | |
static const flags_t | INITIALIZED = 0x04 |
Segment flags denoting an initialzied segment. More... | |
static const PropList | EMPTY |
This is an empty proplist for convenience. More... | |
Protected Member Functions | |
virtual Inst * | decode (address_t address) |
Decode the instruction at the given address. More... | |
virtual | ~Segment (void) |
Protected destructor for avoiding implementation unexpected deletion. More... | |
void | insert (ProgItem *item) |
Insert the item in the list. More... | |
Private Attributes | |
flags_t | _flags |
CString | _name |
Address | _address |
ot::size | _size |
inhstruct::DLList | items |
ProgItem ** | map |
Friends | |
class | File |
In usual file format like ELF, COFF and so on, the program file is divided in segment according platform needs or memory propertes.
typedef t::uint32 otawa::Segment::flags_t |
Build a segment with the given information.
name | Segment name in the file format (".text", ".data", ...). |
address | Segment address in the process memory space. |
size | Segment size (in bytes). |
flags | As returned by the flags() accessor. A combination of WRITABLE, EXECUTABLE and INITIALIZED . |
|
protectedvirtual |
Protected destructor for avoiding implementation unexpected deletion.
References elm::inhstruct::DLList::first(), elm::inhstruct::DLList::isEmpty(), items, map, and elm::inhstruct::DLList::removeFirst().
|
inherited |
Add property to the list without checking of duplication.
prop | Property to add. |
References otawa::Property::_next.
Referenced by otawa::Identifier< T >::add(), otawa::ast::ASTInfo::ASTInfo(), otawa::Identifier< otawa::arm::Info * >::copy(), otawa::AbstractIdentifier::initProps(), otawa::ContextualProperty::make(), otawa::script::Script::makeConfig(), otawa::ccg::Builder::processLBlockSet(), otawa::ipet::ILPSystemGetter::processWorkSpace(), otawa::Identifier< T >::ref(), otawa::ContextualProperty::ref(), and otawa::ContextualProperty::refProps().
|
inherited |
Add all properties from the given property list, in a reverse order.
props | Property list to clone. |
References copy(), otawa::PropList::head, and otawa::Property::next().
Referenced by otawa::display::CFGDrawer::CFGDrawer(), otawa::display::GraphVizGraph::GraphVizGraph(), otawa::ParamFeature::instantiate(), otawa::Manager::loadXML(), otawa::display::GraphVizGraph::newEdge(), otawa::display::GraphVizGraph::newNode(), otawa::PropList::operator=(), otawa::Process::Process(), otawa::PropList::PropList(), otawa::display::GraphVizItem::setProps(), otawa::VirtualBasicBlock::VirtualBasicBlock(), and otawa::VirtualCFG::VirtualCFG().
|
inline |
Get the base address of the segment.
Referenced by findItemAt(), and insert().
|
inherited |
Remove all properties from the list.
References otawa::Property::next().
Referenced by otawa::PSTBuilder::getVCFG(), otawa::PropList::operator=(), otawa::display::GraphVizItem::setProps(), otawa::PropList::~PropList(), and otawa::WorkSpace::~WorkSpace().
|
inline |
References otawa::ot::address().
Decode the instruction at the given address.
This method must overriden by the ISA plugins to provide the actual decoding of the instruction. This method returns null as the default.
address | Address of the instruction to decode. |
Referenced by findInstAt().
|
inherited |
Remove a property matching the given identifier and return it.
Caller is responsible of the management of the obtained property.
id | Identifier of the property to extract. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::script::Script::makeConfig().
|
inlineinherited |
Remove a property matching the given identifier and return it.
Caller is responsible of the management of the obtained property.
id | Identifier of the property to extract. |
References otawa::PropList::extractProp().
Referenced by otawa::PropList::extractProp().
Find an instruction by its address.
addr | Address to find an instruction for. |
References decode(), findItemAt(), insert(), and otawa::ProgItem::toInst().
Find an item by its address.
addr | Address to find an instruction for. |
References otawa::ProgItem::address(), address(), map, MAP_INDEX, otawa::ProgItem::next(), otawa::Address::page(), and topAddress().
Referenced by findInstAt().
|
inline |
Get flag information about the segment.
This flags are composed by OR'ing the constants EXECUTABLE, WRITABLE and INITIALIZED .
|
inherited |
Find a property by its identifier.
id | Identifier of the property to find. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::Identifier< otawa::arm::Info * >::exists(), otawa::ContextualProperty::exists(), otawa::ContextualProperty::find(), otawa::Identifier< T >::get(), otawa::PropList::hasProp(), otawa::ContextualProperty::make(), otawa::ParamFeature::matches(), otawa::ImmutableRef< T, I >::print(), otawa::ContextualProperty::print(), otawa::Identifier< T >::ref(), otawa::ContextualProperty::ref(), otawa::ContextualProperty::refProps(), otawa::Identifier< T >::set(), otawa::Identifier< T >::use(), and otawa::Identifier< T >::value().
|
inlineinherited |
Test if the property list contains a property matching the given identifier.
id | Property identifier to look for. |
References otawa::PropList::getProp().
Referenced by otawa::ipet::BasicConstraintsBuilder::addEntryConstraint(), otawa::Monitor::configure(), otawa::ImmutableRef< T, I >::exists(), and otawa::Manager::setVerbosity().
|
protected |
Insert the item in the list.
item | Item to insert. |
References _, elm::inhstruct::DLList::addFirst(), elm::inhstruct::DLList::addLast(), otawa::ProgItem::address(), address(), elm::inhstruct::DLNode::insertBefore(), items, map, MAP_INDEX, otawa::ProgItem::next(), otawa::ProgItem::previous(), otawa::ProgItem::size(), otawa::ProgItem::topAddress(), and topAddress().
Referenced by findInstAt().
|
inline |
Test if the segment is executable.
|
inline |
Test if the segment is initialized.
|
inline |
Test if the segment is writable.
|
inline |
Get tne name of the segment.
Referenced by otawa::CFGBuilder::buildCFG().
|
inherited |
Display the current property list.
out | Output to use. |
Referenced by otawa::operator<<(), and otawa::ContextualProperty::print().
|
inherited |
Remove all the properties matching the given identifier.
id | Identifier of properties to remove. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::LoopUnroller::unroll().
|
inherited |
Remove a property matching the given identifier.
id | Identifier of the property to remove. |
References otawa::Property::_next, and otawa::Property::next().
Referenced by otawa::PSTBuilder::buildTree(), otawa::BBRemover< T >::clean(), otawa::display::CFGOutput::processCFG(), otawa::SubCFGBuilder::processWorkSpace(), otawa::Ref< T, I >::remove(), and otawa::ContextualPath::Ref< T >::remove().
|
inlineinherited |
References otawa::PropList::removeProp().
Referenced by otawa::PropList::removeProp().
|
inherited |
Set the property in the property list removing any double.
prop | Property to set. |
References otawa::Property::_next, otawa::Property::id(), and otawa::Property::next().
|
inlineinherited |
References otawa::PropList::setProp().
Referenced by otawa::PropList::setProp().
|
inline |
Get the size of the segment.
|
inline |
Referenced by otawa::CFGBuilder::buildCFG(), findItemAt(), and insert().
|
friend |
|
private |
|
private |
|
private |
|
private |
|
staticinherited |
This is an empty proplist for convenience.
|
static |
Segment flags denoting an executable segment.
|
static |
Segment flags denoting an initialzied segment.
|
private |
Referenced by insert(), otawa::Segment::ItemIter::ItemIter(), and ~Segment().
|
private |
Referenced by findItemAt(), insert(), Segment(), and ~Segment().
|
static |
Segment flags denoting a writable segment.