OpenASIP  2.0
Public Member Functions | Protected Types | Protected Attributes | List of all members
InfoCommand Class Reference

#include <InfoCommand.hh>

Inheritance diagram for InfoCommand:
Inheritance graph
Collaboration diagram for InfoCommand:
Collaboration graph

Public Member Functions

 InfoCommand (bool isCompiledSimulation=false)
 
virtual ~InfoCommand ()
 
virtual bool execute (const std::vector< DataObject > &arguments)
 
virtual std::string helpText () const
 
- Public Member Functions inherited from SimControlLanguageCommand
 SimControlLanguageCommand (const std::string &name)
 
virtual ~SimControlLanguageCommand ()
 
SimulatorFrontendsimulatorFrontend ()
 
const SimulatorFrontendsimulatorFrontendConst ()
 
virtual void printNextInstruction ()
 
virtual void printStopInformation ()
 
virtual void printStopReasons ()
 
virtual bool printBreakpointInfo (unsigned int breakpointHandle)
 
virtual void printSimulationTime ()
 
virtual std::ostream & outputStream ()
 
bool checkSimulationInitialized ()
 
bool checkSimulationNotAlreadyRunning ()
 
bool checkSimulationStopped ()
 
bool checkSimulationEnded ()
 
bool checkProgramLoaded ()
 
bool checkMachineLoaded ()
 
InstructionAddress parseInstructionAddressExpression (const std::string &expression)
 
TTAProgram::Address parseDataAddressExpression (const std::string &expression)
 
bool parseBreakpoint (const std::vector< DataObject > &arguments, Breakpoint &target)
 
bool askConditionFromUser (TclConditionScript &target)
 
bool askExpressionFromUser (ExpressionScript &target)
 
bool verifyBreakpointHandles (const std::vector< DataObject > &arguments, std::size_t startIndex=1)
 
void setErrorMessage (const TCEString &errorMsg)
 
- Public Member Functions inherited from CustomCommand
 CustomCommand (std::string name)
 
 CustomCommand (const CustomCommand &cmd)
 
virtual ~CustomCommand ()
 
std::string name () const
 
void setContext (InterpreterContext *context)
 
InterpreterContextcontext () const
 
void setInterpreter (ScriptInterpreter *si)
 
ScriptInterpreterinterpreter () const
 
bool checkArgumentCount (int argumentCount, int minimum, int maximum)
 
bool checkIntegerArgument (const DataObject &argument)
 
bool checkPositiveIntegerArgument (const DataObject &argument)
 
bool checkUnsignedIntegerArgument (const DataObject &argument)
 
bool checkDoubleArgument (const DataObject &argument)
 

Protected Types

typedef std::map< std::string, SimControlLanguageSubCommand * > SubCommandMap
 container type for subcommands indexed by name More...
 

Protected Attributes

SubCommandMap subCommands_
 storage for subcommands More...
 
bool isCompiledSimulation_
 Is it a compiled simulation? More...
 

Additional Inherited Members

- Protected Member Functions inherited from SimControlLanguageCommand
bool setMemoryAddress (const std::string &addressString, std::string &addressSpaceName, std::size_t &memoryAddress)
 
bool setMemoryPointer (MemorySystem::MemoryPtr &memory, const std::string &addressSpaceName)
 

Detailed Description

Implementation of the "info" command of the Simulator Control Language.

Definition at line 48 of file InfoCommand.hh.

Member Typedef Documentation

◆ SubCommandMap

typedef std::map<std::string, SimControlLanguageSubCommand*> InfoCommand::SubCommandMap
protected

container type for subcommands indexed by name

Definition at line 57 of file InfoCommand.hh.

Constructor & Destructor Documentation

◆ InfoCommand()

InfoCommand::InfoCommand ( bool  isCompiledSimulation = false)

Constructor.

Sets the name of the command to the base class.

Definition at line 1415 of file InfoCommand.cc.

1415  :
1416  SimControlLanguageCommand("info"),
1417  isCompiledSimulation_(isCompiledSimulation) {
1418 
1419  if (!isCompiledSimulation_) {
1420  subCommands_["breakpoints"] = new InfoBreakpointsCommand(*this);
1421  subCommands_["busses"] = new InfoBussesCommand(*this);
1422  subCommands_["segments"] = new InfoSegmentsCommand(*this);
1423  }
1424 
1425  subCommands_["stats"] = new InfoStatsCommand(*this);
1426  subCommands_["registers"] = new InfoRegistersCommand(*this);
1427  subCommands_["proc"] = new InfoProcCommand(*this);
1428  subCommands_["program"] = new InfoProgramCommand(*this);
1429  subCommands_["watches"] = new InfoBreakpointsCommand(*this);
1430  subCommands_["regfiles"] = new InfoRegFilesCommand(*this);
1431  subCommands_["iunits"] = new InfoIunitsCommand(*this);
1432  subCommands_["funits"] = new InfoFunitsCommand(*this);
1433  subCommands_["ports"] = new InfoPortsCommand(*this);
1434  subCommands_["immediates"] = new InfoImmediatesCommand(*this);
1435 }

References isCompiledSimulation_, and subCommands_.

◆ ~InfoCommand()

InfoCommand::~InfoCommand ( )
virtual

Destructor.

Definition at line 1440 of file InfoCommand.cc.

1440  {
1442 }

References MapTools::deleteAllValues(), and subCommands_.

Here is the call graph for this function:

Member Function Documentation

◆ execute()

bool InfoCommand::execute ( const std::vector< DataObject > &  arguments)
virtual

Executes the "info" command.

Provides various information of the simulation.

Parameters
argumentsSubcommand and possible arguments to the subcommand.
Returns
Always true if arguments are valid.

Implements CustomCommand.

Definition at line 1453 of file InfoCommand.cc.

1453  {
1454  assert(interpreter() != NULL);
1455 
1456  // "info" as such does not do anything, a subcommand is required.
1457  if (!checkArgumentCount(arguments.size() - 1, 1, INT_MAX)) {
1458  return false;
1459  }
1460 
1461  SubCommandMap::iterator subCommandPosition =
1462  subCommands_.find(
1463  StringTools::stringToLower(arguments.at(1).stringValue()));
1464  if (subCommandPosition == subCommands_.end()) {
1465  interpreter()->setError(
1468  return false;
1469  }
1470 
1471  assert((*subCommandPosition).second != NULL);
1472  SimControlLanguageSubCommand& subCommand = *((*subCommandPosition).second);
1473 
1474  return subCommand.execute(arguments);
1475 }

References assert, CustomCommand::checkArgumentCount(), SimControlLanguageSubCommand::execute(), CustomCommand::interpreter(), ScriptInterpreter::setError(), StringTools::stringToLower(), subCommands_, SimulatorToolbox::textGenerator(), and Texts::TXT_UNKNOWN_SUBCOMMAND.

Here is the call graph for this function:

◆ helpText()

std::string InfoCommand::helpText ( ) const
virtual

Returns the help text for this command.

Help text is searched from SimulatorTextGenerator.

Returns
The help text.

Implements CustomCommand.

Definition at line 1485 of file InfoCommand.cc.

1485  {
1488 }

References Texts::TextGenerator::text(), SimulatorToolbox::textGenerator(), and Texts::TXT_INTERP_HELP_INFO.

Here is the call graph for this function:

Member Data Documentation

◆ isCompiledSimulation_

bool InfoCommand::isCompiledSimulation_
protected

Is it a compiled simulation?

Definition at line 62 of file InfoCommand.hh.

Referenced by InfoCommand().

◆ subCommands_

SubCommandMap InfoCommand::subCommands_
protected

storage for subcommands

Definition at line 59 of file InfoCommand.hh.

Referenced by execute(), InfoCommand(), and ~InfoCommand().


The documentation for this class was generated from the following files:
CustomCommand::checkArgumentCount
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
Definition: CustomCommand.cc:82
InfoPortsCommand
Definition: InfoCommand.cc:501
InfoCommand::subCommands_
SubCommandMap subCommands_
storage for subcommands
Definition: InfoCommand.hh:59
MapTools::deleteAllValues
static void deleteAllValues(MapType &aMap)
InfoProcCommand
Definition: InfoCommand.cc:721
InfoBreakpointsCommand
Definition: InfoCommand.cc:1351
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
InfoIunitsCommand
Definition: InfoCommand.cc:359
assert
#define assert(condition)
Definition: Application.hh:86
SimControlLanguageCommand::SimControlLanguageCommand
SimControlLanguageCommand(const std::string &name)
Definition: SimControlLanguageCommand.cc:67
InfoBussesCommand
Definition: InfoCommand.cc:413
InfoStatsCommand
Definition: InfoCommand.cc:1120
Texts::TXT_UNKNOWN_SUBCOMMAND
@ TXT_UNKNOWN_SUBCOMMAND
Definition: TextGenerator.hh:65
Texts::TXT_INTERP_HELP_INFO
@ TXT_INTERP_HELP_INFO
Help text for command "info" of the CLI.
Definition: SimulatorTextGenerator.hh:83
InfoImmediatesCommand
Definition: InfoCommand.cc:206
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
SimControlLanguageSubCommand::execute
virtual bool execute(const std::vector< DataObject > &arguments)=0
InfoProgramCommand
Definition: InfoCommand.cc:1236
InfoCommand::isCompiledSimulation_
bool isCompiledSimulation_
Is it a compiled simulation?
Definition: InfoCommand.hh:62
CustomCommand::interpreter
ScriptInterpreter * interpreter() const
InfoSegmentsCommand
Definition: InfoCommand.cc:595
ScriptInterpreter::setError
virtual void setError(bool state)
Definition: ScriptInterpreter.cc:205
SimControlLanguageSubCommand
Definition: SimControlLanguageCommand.hh:122
InfoRegFilesCommand
Definition: InfoCommand.cc:305
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
InfoRegistersCommand
Definition: InfoCommand.cc:92
InfoFunitsCommand
Definition: InfoCommand.cc:665