ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
etiss::plugin::VariableValueLogger Class Reference

writes the value of a field before each instruction More...

#include <VariableValueLogger.h>

Inheritance diagram for etiss::plugin::VariableValueLogger:
Inheritance graph
[legend]
Collaboration diagram for etiss::plugin::VariableValueLogger:
Collaboration graph
[legend]

Public Member Functions

 VariableValueLogger (const std::string &field, const std::string &file, std::function< void(std::ostream &out, const std::string &field, uint64_t value)> writer)
 
virtual void initCodeBlock (etiss::CodeBlock &block) const
 called before instructions are translated for the code block More...
 
virtual void finalizeInstrSet (etiss::instr::ModedInstructionSet &) const
 called after all instructions have been added to allow last changes More...
 
void writeValue ()
 Calls the function specified with writer_ to log the variable. More...
 
- Public Member Functions inherited from etiss::TranslationPlugin
 TranslationPlugin ()
 
virtual ~TranslationPlugin ()
 
virtual void initInstrSet (etiss::instr::ModedInstructionSet &) const
 called to add instructions to the instruction set More...
 
virtual void finalizeCodeBlock (etiss::CodeBlock &) const
 called after all instructions have been translated for the code block More...
 
virtual void * getPluginHandle ()
 called to get the handle that is available in translated code via getPoinerCode(). [default: this] More...
 
- Public Member Functions inherited from etiss::Plugin
virtual ~Plugin ()
 
unsigned getType ()
 
InterruptListenerPlugingetInterruptListenerPlugin ()
 
CoroutinePlugingetCoroutinePlugin ()
 
SystemWrapperPlugingetSystemWrapperPlugin ()
 
RegisterDevicePlugingetRegisterDevicePlugin ()
 
TranslationPlugingetTranslationPlugin ()
 
std::string getPluginName () const
 
const std::string & getLastAssignedCoreName ()
 
std::string toString () const
 
- Public Member Functions inherited from etiss::ToString
 ToString ()
 
virtual ~ToString ()
 

Protected Member Functions

virtual std::string _getPluginName () const
 returns the name of the Plugin. More...
 
- Protected Member Functions inherited from etiss::TranslationPlugin
std::string getPointerCode () const
 returns a C code expression that allows to get or assign a pointer to the variable assigned to this translation plugin. More...
 
- Protected Member Functions inherited from etiss::Plugin
 Plugin (unsigned type=0)
 
virtual void init (ETISS_CPU *cpu, ETISS_System *system, CPUArch *arch)
 this function is called before the plugin is used in the cpu execution loop (etiss::CPUCore::execute). More...
 
virtual void cleanup ()
 this function is called after cpu execution loop (etiss::CPUCore::execute) finished. More...
 
void setCorrespondingCPUCoreName (std::string name)
 
virtual void addedToCPUCore (etiss::CPUCore *core)
 called as soon a plugin has been added to its CPUCore. More...
 
virtual void removedFromCPUCore (etiss::CPUCore *core)
 called as soon a plugin has been removed from its CPUCore. More...
 

Private Attributes

std::string field_
 Name of the field to log. More...
 
std::function< void(std::ostream &out, const std::string &field, uint64_t value)> writer_
 Function which specifies the outout format. More...
 
std::ofstream out_
 file stream for logger. More...
 

Additional Inherited Members

- Static Public Attributes inherited from etiss::Plugin
static const unsigned INTERRUPTLISTENER = 1 << 0
 access to translated code More...
 
static const unsigned COROUTINE = 1 << 1
 callback after execution of each translated block More...
 
static const unsigned SYSTEMWRAPPER = 1 << 2
 can wrap/change ETISS_System structure at execution start More...
 
static const unsigned REGISTERDEVICE
 gets noticed of changes to special registers (e.g. mmu register etc. [depends on architecture]) More...
 
static const unsigned TRANSLATION
 access to translated code during translation phase or when instruction tree is built More...
 
- Protected Attributes inherited from etiss::Plugin
ETISS_CPUplugin_cpu_
 holds a pointer to the cpu structure. will be set before init call and after cleanup call More...
 
ETISS_Systemplugin_system_
 holds a pointer to the system structure. More...
 
CPUArchplugin_arch_
 holds a pointer to the CPUArch instance. will be set before init call and after cleanup call More...
 
CPUCoreplugin_core_
 holds a pointer to the associated CPUCore instance. More...
 

Detailed Description

writes the value of a field before each instruction

Definition at line 60 of file VariableValueLogger.h.

Constructor & Destructor Documentation

◆ VariableValueLogger()

etiss::plugin::VariableValueLogger::VariableValueLogger ( const std::string &  field,
const std::string &  file,
std::function< void(std::ostream &out, const std::string &field, uint64_t value)>  writer 
)

Definition at line 64 of file VariableValueLogger.cpp.

References out_, uint64_t, get_metrics::writer, and writer_.

Member Function Documentation

◆ _getPluginName()

std::string etiss::plugin::VariableValueLogger::_getPluginName ( ) const
protectedvirtual

returns the name of the Plugin.

Implements etiss::Plugin.

Definition at line 115 of file VariableValueLogger.cpp.

References field_.

◆ finalizeInstrSet()

void etiss::plugin::VariableValueLogger::finalizeInstrSet ( etiss::instr::ModedInstructionSet ) const
virtual

◆ initCodeBlock()

void etiss::plugin::VariableValueLogger::initCodeBlock ( etiss::CodeBlock ) const
virtual

called before instructions are translated for the code block

Reimplemented from etiss::TranslationPlugin.

Definition at line 77 of file VariableValueLogger.cpp.

References etiss::CodeBlock::fileglobalCode().

Here is the call graph for this function:

◆ writeValue()

void etiss::plugin::VariableValueLogger::writeValue ( )

Calls the function specified with writer_ to log the variable.

Definition at line 102 of file VariableValueLogger.cpp.

References field_, etiss::CPUCore::getStruct(), ETISS_CPU::instructionPointer, out_, etiss::Plugin::plugin_core_, etiss::Plugin::plugin_cpu_, and writer_.

Referenced by etiss_plugin_VariableValueLogger().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ field_

std::string etiss::plugin::VariableValueLogger::field_
private

Name of the field to log.

Definition at line 79 of file VariableValueLogger.h.

Referenced by _getPluginName(), finalizeInstrSet(), and writeValue().

◆ out_

std::ofstream etiss::plugin::VariableValueLogger::out_
private

file stream for logger.

Definition at line 88 of file VariableValueLogger.h.

Referenced by VariableValueLogger(), and writeValue().

◆ writer_

std::function<void(std::ostream &out, const std::string &field, uint64_t value)> etiss::plugin::VariableValueLogger::writer_
private

Function which specifies the outout format.

Default output: <field>,


Parameters
Referenceto file stream for writing data.
Nameof the field to log.
Valueof the field to log.

Definition at line 87 of file VariableValueLogger.h.

Referenced by VariableValueLogger(), and writeValue().


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