OpenASIP  2.0
Public Member Functions | List of all members
ResumeCommand Class Reference

#include <ResumeCommand.hh>

Inheritance diagram for ResumeCommand:
Inheritance graph
Collaboration diagram for ResumeCommand:
Collaboration graph

Public Member Functions

 ResumeCommand ()
 
virtual ~ResumeCommand ()
 
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)
 

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 "resume" command of the Simulator Control Language.

Definition at line 47 of file ResumeCommand.hh.

Constructor & Destructor Documentation

◆ ResumeCommand()

ResumeCommand::ResumeCommand ( )

Constructor.

Sets the name of the command to the base class.

Definition at line 46 of file ResumeCommand.cc.

46  :
47  SimControlLanguageCommand("resume") {
48 }

◆ ~ResumeCommand()

ResumeCommand::~ResumeCommand ( )
virtual

Destructor.

Does nothing.

Definition at line 55 of file ResumeCommand.cc.

55  {
56 }

Member Function Documentation

◆ execute()

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

Executes the "resume" command.

Resume simulation of the program until the simulation is finished or a breakpoint is reached. The optional argument gives the number of times the continue command is repeated, that is, the number of times breakpoints should be ignored.

Parameters
arguments(optional) count of times to repeat in case breakpoints are reached.
Returns
Always true.
Exceptions
NumberFormatExceptionIs never thrown by this command.

Implements CustomCommand.

Definition at line 73 of file ResumeCommand.cc.

73  {
74  // how many times breakpoints should be ignored?
75  int repeatCount = 0;
76  if (!checkArgumentCount(arguments.size() - 1, 0, 1)) {
77  return false;
78  } else {
79  if (arguments.size() > 1) {
80  if (!checkPositiveIntegerArgument(arguments[1])) {
81  return false;
82  } else {
83  repeatCount = arguments[1].integerValue();
84  }
85  }
86  }
87 
88  if (!checkSimulationStopped()) {
89  return false;
90  }
91 
92  int repeats = 0;
93  do {
95  ++repeats;
96  } while(simulatorFrontend().isSimulationStopped() &&
97  repeats < repeatCount);
98 
100 
101  return true;
102 }

References CustomCommand::checkArgumentCount(), CustomCommand::checkPositiveIntegerArgument(), SimControlLanguageCommand::checkSimulationStopped(), SimControlLanguageCommand::printStopInformation(), SimulatorFrontend::run(), and SimControlLanguageCommand::simulatorFrontend().

Here is the call graph for this function:

◆ helpText()

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

Returns the help text for this command.

Help text is searched from SimulatorTextGenerator.

Returns
The help text.
Todo:
Use SimulatorTextGenerator to get the help text.

Implements CustomCommand.

Definition at line 113 of file ResumeCommand.cc.

113  {
116 }

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

Here is the call graph for this function:

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
SimControlLanguageCommand::checkSimulationStopped
bool checkSimulationStopped()
Definition: SimControlLanguageCommand.cc:135
CustomCommand::checkPositiveIntegerArgument
bool checkPositiveIntegerArgument(const DataObject &argument)
Definition: CustomCommand.cc:134
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
SimulatorFrontend::run
virtual void run()
Definition: SimulatorFrontend.cc:997
SimControlLanguageCommand::printStopInformation
virtual void printStopInformation()
Definition: SimControlLanguageCommand.cc:243
SimControlLanguageCommand::SimControlLanguageCommand
SimControlLanguageCommand(const std::string &name)
Definition: SimControlLanguageCommand.cc:67
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
Texts::TXT_INTERP_HELP_RESUME
@ TXT_INTERP_HELP_RESUME
Help text for command "resume" of the CLI.
Definition: SimulatorTextGenerator.hh:79
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214