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

#include <EnableBPCommand.hh>

Inheritance diagram for EnableBPCommand:
Inheritance graph
Collaboration diagram for EnableBPCommand:
Collaboration graph

Public Member Functions

 EnableBPCommand ()
 
virtual ~EnableBPCommand ()
 
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 "enablebp" command of the Simulator Control Language.

Definition at line 47 of file EnableBPCommand.hh.

Constructor & Destructor Documentation

◆ EnableBPCommand()

EnableBPCommand::EnableBPCommand ( )

Constructor.

Sets the name of the command to the base class.

Definition at line 52 of file EnableBPCommand.cc.

52  :
53  SimControlLanguageCommand("enablebp") {
54 }

◆ ~EnableBPCommand()

EnableBPCommand::~EnableBPCommand ( )
virtual

Destructor.

Does nothing.

Definition at line 61 of file EnableBPCommand.cc.

61  {
62 }

Member Function Documentation

◆ execute()

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

Executes the "enablebp" command.

Enables the given breakpoints.

Parameters
argumentsThe handle(s) of the breakpoint(s) to enable.
Returns
True in case simulation is initialized and arguments are ok.
Exceptions
NumberFormatExceptionIs never thrown by this command.
Todo:
Use the count for the step.

Implements CustomCommand.

Definition at line 75 of file EnableBPCommand.cc.

75  {
76  if (!checkArgumentCount(arguments.size() - 1, 1, INT_MAX)) {
77  return false;
78  }
79 
80  if (!checkSimulationStopped()) {
82  return false;
83  }
84  }
85 
86  const std::string firstArgument =
88  arguments[1].stringValue()));
89 
90  bool enableOnce = false;
91  bool temporary = false;
92  int firstHandleIndex = 1;
93  if (firstArgument == "once") {
94  enableOnce = true;
95  firstHandleIndex = 2;
96  } else if (firstArgument == "delete") {
97  temporary = true;
98  firstHandleIndex = 2;
99  }
100 
101  StopPointManager& breakpointManager =
103 
104  if (!verifyBreakpointHandles(arguments, firstHandleIndex)) {
105  return false;
106  }
107 
108  // enable (and modify the properties of) the given breakpoints
109  for (size_t i = firstHandleIndex; i < arguments.size(); ++i) {
110  const unsigned int breakpointHandle = arguments[i].integerValue();
111  breakpointManager.enable(breakpointHandle);
112  if (enableOnce) {
113  breakpointManager.enableOnceAndDisable(breakpointHandle);
114  }
115  if (temporary) {
116  breakpointManager.enableOnceAndDelete(breakpointHandle);
117  }
118  printBreakpointInfo(breakpointHandle);
119  }
120  return true;
121 }

References CustomCommand::checkArgumentCount(), SimControlLanguageCommand::checkSimulationInitialized(), SimControlLanguageCommand::checkSimulationStopped(), StopPointManager::enable(), StopPointManager::enableOnceAndDelete(), StopPointManager::enableOnceAndDisable(), SimControlLanguageCommand::printBreakpointInfo(), SimControlLanguageCommand::simulatorFrontend(), SimulatorFrontend::stopPointManager(), StringTools::stringToLower(), temporary, StringTools::trim(), and SimControlLanguageCommand::verifyBreakpointHandles().

Here is the call graph for this function:

◆ helpText()

std::string EnableBPCommand::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 132 of file EnableBPCommand.cc.

132  {
135 }

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

Here is the call graph for this function:

The documentation for this class was generated from the following files:
StopPointManager::enableOnceAndDelete
void enableOnceAndDelete(unsigned int handle)
Definition: StopPointManager.cc:172
CustomCommand::checkArgumentCount
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
Definition: CustomCommand.cc:82
SimControlLanguageCommand::checkSimulationStopped
bool checkSimulationStopped()
Definition: SimControlLanguageCommand.cc:135
StopPointManager::enableOnceAndDisable
void enableOnceAndDisable(unsigned int handle)
Definition: StopPointManager.cc:187
Texts::TXT_INTERP_HELP_ENABLEBP
@ TXT_INTERP_HELP_ENABLEBP
Help text for command "enablebp" of the CLI.
Definition: SimulatorTextGenerator.hh:97
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
SimControlLanguageCommand::verifyBreakpointHandles
bool verifyBreakpointHandles(const std::vector< DataObject > &arguments, std::size_t startIndex=1)
Definition: SimControlLanguageCommand.cc:712
SimControlLanguageCommand::SimControlLanguageCommand
SimControlLanguageCommand(const std::string &name)
Definition: SimControlLanguageCommand.cc:67
StopPointManager::enable
void enable(unsigned int handle)
Definition: StopPointManager.cc:149
StopPointManager
Definition: StopPointManager.hh:50
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
SimControlLanguageCommand::checkSimulationInitialized
bool checkSimulationInitialized()
Definition: SimControlLanguageCommand.cc:88
StringTools::trim
static std::string trim(const std::string &source)
Definition: StringTools.cc:55
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214
temporary
SimValue * temporary
Definition: POMGenMacros.hh:76
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
SimulatorFrontend::stopPointManager
StopPointManager & stopPointManager()
Definition: SimulatorFrontend.cc:2108
SimControlLanguageCommand::printBreakpointInfo
virtual bool printBreakpointInfo(unsigned int breakpointHandle)
Definition: SimControlLanguageCommand.cc:678