Otawa  0.10
otawa::Process Class Referenceabstract

A process is the realization of a program on a platform. More...

#include <otawa/prog/Process.h>

Inheritance diagram for otawa::Process:
otawa::PropList elm::Lock otawa::loader::new_gliss::Process otawa::loader::old_gliss::Process

Classes

class  FileIter
 

Public Member Functions

 Process (Manager *manager, const PropList &props=EMPTY, File *program=0)
 Build a new empty process. More...
 
virtual ~Process (void)
 
virtual hard::Platformplatform (void)=0
 Get the platform of the process. More...
 
Managermanager (void)
 Get the manager owning this process. More...
 
virtual const
hard::CacheConfiguration
cache (void)
 Get the cache hierarchy of the current processor. More...
 
virtual Inststart (void)=0
 Get the address of the first instruction of the program. More...
 
virtual InstfindInstAt (address_t addr)
 Find the instruction at the given address. More...
 
virtual address_t findLabel (const string &label)
 Find the address of the given label. More...
 
virtual InstfindInstAt (const string &label)
 find the instruction at the given label if the label matches a code segment. More...
 
Fileprogram (void) const
 Get the program file, that is, the startup executable of the process. More...
 
virtual int instSize (void) const =0
 Get the instruction size. More...
 
virtual Processordecoder (void)
 Get a decoder usuful to decode instructions. More...
 
virtual Loaderloader (void) const
 Get the loader that has created this process. More...
 
SymbolfindSymbol (const string &name)
 Find the symbol matching the given name. More...
 
SymbolfindSymbolAt (const Address &address)
 Find a symbol by its address. More...
 
virtual Address initialSP (void) const
 Get the initial address of the stack pointer. More...
 
virtual InstnewNOp (Address addr=Address::null)
 Build a NOP instruction at the given address. More...
 
virtual void deleteNop (Inst *inst)
 Delete a NOP instruction previously allocated by NewOP(). More...
 
virtual int maxTemp (void) const
 Get the maximum number of temporaries used in the semantics instruction block. More...
 
virtual void get (Address at, t::int8 &val)
 Get a signed byte value from the process. More...
 
virtual void get (Address at, t::uint8 &val)
 Get an unsigned byte value from the process. More...
 
virtual void get (Address at, t::int16 &val)
 Get a signed half-word value from the process. More...
 
virtual void get (Address at, t::uint16 &val)
 Get a unsigned half-word value from the process. More...
 
virtual void get (Address at, t::int32 &val)
 Get a signed word value from the process. More...
 
virtual void get (Address at, t::uint32 &val)
 Get a unsigned word value from the process. More...
 
virtual void get (Address at, t::int64 &val)
 Get a signed long word value from the process. More...
 
virtual void get (Address at, t::uint64 &val)
 Get a unsigned long word value from the process. More...
 
virtual void get (Address at, Address &val)
 Get an address value from the process. More...
 
virtual void get (Address at, float &val)
 Get a float value from the process. More...
 
virtual void get (Address at, double &val)
 Get a double value from the process. More...
 
virtual void get (Address at, long double &val)
 Get a long double value from the process. More...
 
virtual void get (Address at, string &str)
 Get a string value from the process. More...
 
virtual void get (Address at, char *buf, int size)
 Get a byte block value from the process. More...
 
virtual Option< Pair< cstring,
int > > 
getSourceLine (Address addr) throw (UnsupportedFeatureException)
 Get the source file and the line matching the given address. More...
 
virtual void getAddresses (cstring file, int line, Vector< Pair< Address, Address > > &addresses) throw (UnsupportedFeatureException)
 Get the list of addresses implementing the given (source, line) pair. More...
 
virtual SimStatenewState (void)
 Get a fresh startup state of the process for functional simulation. More...
 
virtual sim::Simulatorsimulator (void)
 Find the simulator used for the current process. More...
 
FileloadProgram (elm::CString path)
 Load the program file. More...
 
virtual FileloadFile (elm::CString path)=0
 Load an existing file. More...
 
virtual Address defaultStack (void) const
 Get a default address for the stack top. More...
 
virtual void semInit (sem::Block &block) const
 Provide semantic sequence to initialize the environment before performing static analysis. More...
 
PropertygetProp (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)
 
PropertyextractProp (const AbstractIdentifier *id)
 Remove a property matching the given identifier and return it. More...
 
PropertyextractProp (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...
 
void lock (void)
 
void unlock ()
 

Static Public Attributes

static const PropList EMPTY
 This is an empty proplist for convenience. More...
 

Protected Member Functions

void addFile (File *file)
 Add the given file to the list of files. More...
 
void provide (AbstractFeature &feature)
 This method let provide feature from the loader / processors. More...
 

Private Member Functions

void link (WorkSpace *ws)
 This method is called each a workspace using the current process is created. More...
 
void unlink (WorkSpace *ws)
 This method is called each a workspace using the current process is deleted. More...
 

Private Attributes

Vector< File * > files
 Get the list of files used in this process. More...
 
Vector< AbstractFeature * > provided
 
Fileprog
 
Managerman
 
stree::Tree< Address::offset_t,
Symbol * > * 
smap
 

Friends

class WorkSpace
 

Detailed Description

A process is the realization of a program on a platform.

It represents the program and its implementation on the platform. A process may be formed by many files in case of shared object for example. A process provides the information needed for simulating, analyzing or transforming a program.

Constructor & Destructor Documentation

otawa::Process::Process ( Manager manager,
const PropList props = EMPTY,
File program = 0 
)

Build a new empty process.

Parameters
managerCurrent manager.
propsConfiguration properties to create this process.
programThe program file creating this process.

References addFile(), otawa::PropList::addProps(), and prog.

otawa::Process::~Process ( void  )
virtual

References smap.

Member Function Documentation

void otawa::Process::addFile ( File file)
protected

Add the given file to the list of files.

The first added file is considered as the program file.

Parameters
fileAdded file.
Note
After this call, the process is the owner of the file and will released it at deletion time.

References files, and prog.

Referenced by Process().

const hard::CacheConfiguration & otawa::Process::cache ( void  )
virtual

Get the cache hierarchy of the current processor.

The cachers are ordered according the index in the vector.

Returns
Cache hierarchy.

References otawa::hard::Platform::cache(), and platform().

void otawa::PropList::clearProps ( void  )
inherited
Processor * otawa::Process::decoder ( void  )
virtual

Get a decoder usuful to decode instructions.

May be overriden to give instruction set architecture dependent decoders.

Returns
Instruction decoder or null if none is defined.

Referenced by otawa::TextDecoder::processWorkSpace().

Address otawa::Process::defaultStack ( void  ) const
virtual

Get a default address for the stack top.

Returns
Default address of stack top.

Referenced by otawa::clp::Analysis::processWorkSpace(), and otawa::dcache::BlockBuilder::setup().

void otawa::Process::deleteNop ( Inst inst)
virtual

Delete a NOP instruction previously allocated by NewOP().

Parameters
instInstruction to delete.
Property * otawa::PropList::extractProp ( const AbstractIdentifier id)
inherited

Remove a property matching the given identifier and return it.

Caller is responsible of the management of the obtained property.

Parameters
idIdentifier of the property to extract.

References otawa::Property::_next, and otawa::Property::next().

Referenced by otawa::script::Script::makeConfig().

Property * otawa::PropList::extractProp ( const AbstractIdentifier id)
inlineinherited

Remove a property matching the given identifier and return it.

Caller is responsible of the management of the obtained property.

Parameters
idIdentifier of the property to extract.

References otawa::PropList::extractProp().

Referenced by otawa::PropList::extractProp().

Inst * otawa::Process::findInstAt ( const string label)
virtual

find the instruction at the given label if the label matches a code segment.

Parameters
labelLabel to look for.
Returns
Matching instruction or null.

References findInstAt(), and findLabel().

address_t otawa::Process::findLabel ( const string label)
virtual

Find the address of the given label.

For performing it, it looks iteratively one each file of the process until finding it.

Parameters
labelLabel to find.
Returns
Found address or null.

References otawa::Address::null.

Referenced by otawa::FlowFactLoader::addressOf(), and findInstAt().

Symbol * otawa::Process::findSymbol ( const string name)

Find the symbol matching the given name.

Parameters
nameSymbol name to look for.
Returns
Found symbol or null.

Referenced by otawa::LabelAddress::toAddress().

Symbol * otawa::Process::findSymbolAt ( const Address address)

Find a symbol by its address.

Parameters
addressAddress of the looked symbol.
Returns
Found symbol or null.

References elm::stree::SegmentBuilder< K, T, class >::add(), otawa::Symbol::DATA, otawa::Symbol::FUNCTION, elm::stree::SegmentBuilder< K, T, class >::make(), otawa::Address::offset(), and smap.

void otawa::Process::get ( Address  at,
t::int8 val 
)
virtual

Get a signed byte value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

Referenced by otawa::VarTextDecoder::getBytes(), and otawa::CFGCheckSummer::processCFG().

void otawa::Process::get ( Address  at,
t::uint8 val 
)
virtual

Get an unsigned byte value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
t::int16 val 
)
virtual

Get a signed half-word value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
t::uint16 val 
)
virtual

Get a unsigned half-word value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
t::int32 val 
)
virtual

Get a signed word value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
t::uint32 val 
)
virtual

Get a unsigned word value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
t::int64 val 
)
virtual

Get a signed long word value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
t::uint64 val 
)
virtual

Get a unsigned long word value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
Address val 
)
virtual

Get an address value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
float &  val 
)
virtual

Get a float value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
double &  val 
)
virtual

Get a double value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
long double &  val 
)
virtual

Get a long double value from the process.

Parameters
atAddress of the value to get.
valGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
string str 
)
virtual

Get a string value from the process.

Parameters
atAddress of the value to get.
strGot value.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::get ( Address  at,
char *  buf,
int  size 
)
virtual

Get a byte block value from the process.

Parameters
atAddress of the value to get.
bufBuffer to store block to.
sizeSize of block.
Exceptions
UnsupportedFeatureExceptionif this method is called but the loader does not provide this feature.
OutOfMemStaticExceptionif the given address does not point to a static segment of the executable file.
Warning
To use this method, you must assert that the MEMORY_ACCESS_FEATURE is provided.

Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.

References otawa::MEMORY_ACCESS_FEATURE.

void otawa::Process::getAddresses ( cstring  file,
int  line,
Vector< Pair< Address, Address > > &  addresses 
)
throw (UnsupportedFeatureException
)
virtual

Get the list of addresses implementing the given (source, line) pair.

Parameters
fileLooked source file.
lineLooked source line.
addressesOutput parameter containing the list of address ranges matching the given line. This vector is empty if the source (file, line) cannot be found.
Exceptions
UnsupportedFeatureExceptionIf this function is called and the feature SOURCE_LINE_FEATURE is not implemented.

Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.

References otawa::SOURCE_LINE_FEATURE.

Referenced by otawa::ipet::FlowFactLoader::lookLineAt().

Option< Pair< cstring, int > > otawa::Process::getSourceLine ( Address  addr)
throw (UnsupportedFeatureException
)
virtual

Get the source file and the line matching the given address.

Parameters
addrAddress to get source and line.
Returns
Optional (file, line) pair if the address is found.
Exceptions
UnsupportedFeatureExceptionIf this function is called and the feature SOURCE_LINE_FEATURE is not implemented.

Reimplemented in otawa::loader::old_gliss::Process, and otawa::loader::new_gliss::Process.

References otawa::SOURCE_LINE_FEATURE.

Referenced by otawa::WorkSpace::format(), otawa::ipet::FlowFactLoader::lookLineAt(), otawa::cfgio::Output::processBB(), and otawa::BBRatioDisplayer::processBB().

bool otawa::PropList::hasProp ( const AbstractIdentifier id) const
inlineinherited

Test if the property list contains a property matching the given identifier.

Parameters
idProperty identifier to look for.
Returns
True if the list contains the matching property, false else.

References otawa::PropList::getProp().

Referenced by otawa::ipet::BasicConstraintsBuilder::addEntryConstraint(), otawa::Monitor::configure(), otawa::ImmutableRef< T, I >::exists(), and otawa::Manager::setVerbosity().

Address otawa::Process::initialSP ( void  ) const
virtual

Get the initial address of the stack pointer.

If the program is embedded, this call does not return any meaningful value as the value is initialized at the program start. For program running in a rich OS environment, this is the value of the stack pointer after the OS has filled environment and program arguments.

Returns
Initial stack pointer address.

References otawa::Address::null.

int otawa::Process::instSize ( void  ) const
pure virtual

Get the instruction size.

Returns
Instruction size or 0 for variable instruction size.

Referenced by otawa::VarTextDecoder::getInst(), newNOp(), otawa::ParExeGraph::ParExeGraph(), otawa::TextDecoder::processWorkSpace(), and otawa::FixedTextDecoder::setup().

void otawa::Process::link ( WorkSpace ws)
private

This method is called each a workspace using the current process is created.

It may be used to perform some workspace initialization like feature providing.

References otawa::WorkSpace::provide(), and provided.

Loader * otawa::Process::loader ( void  ) const
virtual

Get the loader that has created this process.

The result may be null.

Returns
Loader that created this process.

Reimplemented in otawa::loader::old_gliss::Process.

Referenced by otawa::Loader::check(), and otawa::WorkSpace::serialize().

File * otawa::Process::loadFile ( elm::CString  path)
pure virtual

Load an existing file.

Parameters
pathPath to the file to load.
Returns
The loaded file.
Exceptions
LoadExceptionError during the load.
UnsupportedPlatformExceptionPlatform of the file does not match the platform of the process.

Implemented in otawa::loader::new_gliss::Process, and otawa::loader::old_gliss::Process.

Referenced by loadProgram().

File * otawa::Process::loadProgram ( elm::CString  path)

Load the program file.

References loadFile(), and prog.

Manager * otawa::Process::manager ( void  )
inline

Get the manager owning this process.

Returns
Process manager.

Referenced by otawa::ipet::ILPSystemGetter::processWorkSpace(), and simulator().

int otawa::Process::maxTemp ( void  ) const
virtual

Get the maximum number of temporaries used in the semantics instruction block.

Returns
Maximum number of temporaries.
Inst * otawa::Process::newNOp ( Address  addr = Address::null)
virtual

Build a NOP instruction at the given address.

Parameters
addrAddress of the instruction (default to null address).
Returns
Built NOP instruction (must fried by deleteNop() call).

References instSize().

SimState * otawa::Process::newState ( void  )
virtual

Get a fresh startup state of the process for functional simulation.

Returns
Startup state, possibly null if the process does not support functional simulation/
Platform * otawa::Process::platform ( void  )
pure virtual
void otawa::PropList::print ( elm::io::Output out) const
inherited

Display the current property list.

Parameters
outOutput to use.

Referenced by otawa::operator<<(), and otawa::ContextualProperty::print().

void otawa::Process::provide ( AbstractFeature feature)
protected

This method let provide feature from the loader / processors.

References provided.

void otawa::PropList::removeAllProp ( const AbstractIdentifier id)
inherited

Remove all the properties matching the given identifier.

Parameters
idIdentifier of properties to remove.

References otawa::Property::_next, and otawa::Property::next().

Referenced by otawa::LoopUnroller::unroll().

void otawa::PropList::removeProp ( const AbstractIdentifier id)
inherited
void otawa::PropList::removeProp ( const AbstractIdentifier id)
inlineinherited
void otawa::Process::semInit ( sem::Block block) const
virtual

Provide semantic sequence to initialize the environment before performing static analysis.

As a default, do nothing.

void otawa::PropList::setProp ( Property prop)
inherited

Set the property in the property list removing any double.

Parameters
propProperty to set.

References otawa::Property::_next, otawa::Property::id(), and otawa::Property::next().

void otawa::PropList::setProp ( const AbstractIdentifier id)
inlineinherited
sim::Simulator * otawa::Process::simulator ( void  )
virtual

Find the simulator used for the current process.

Returns
A simulator for the current process or null if none is found.

References _, otawa::Manager::findSimulator(), manager(), name, otawa::SIMULATOR, and otawa::SIMULATOR_NAME.

Referenced by otawa::tsim::BBTimeSimulator::setup(), and otawa::tsim::BBPath::simulate().

address_t otawa::Process::start ( void  )
pure virtual

Get the address of the first instruction of the program.

Returns
Address of the first instruction of the program or null if it unknown.

Implemented in otawa::loader::new_gliss::Process, and otawa::loader::old_gliss::Process.

void otawa::Process::unlink ( WorkSpace ws)
private

This method is called each a workspace using the current process is deleted.

Friends And Related Function Documentation

friend class WorkSpace
friend

Member Data Documentation

const PropList otawa::PropList::EMPTY
staticinherited

This is an empty proplist for convenience.

const elm::Collection< File * > * otawa::Process::files
private

Get the list of files used in this process.

Returns
List of files.

Referenced by addFile().

Manager* otawa::Process::man
private
File* otawa::Process::prog
private

Referenced by addFile(), loadProgram(), and Process().

Vector<AbstractFeature *> otawa::Process::provided
private

Referenced by link(), and provide().

stree::Tree<Address::offset_t, Symbol *>* otawa::Process::smap
private

Referenced by findSymbolAt(), and ~Process().


The documentation for this class was generated from the following files: