OpenASIP  2.0
SimControlLanguageCommand.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * Implementation of SimControlLanguageCommand class
26  *
27  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
28  * @author Henry Linjamäki 2017 (henry.linjamaki-no.spam-tut.fi)
29  * @note rating: red
30  */
31 
32 #include <iostream>
33 #include <iomanip>
34 #include <cmath>
37 #include "SimulatorFrontend.hh"
38 #include "SimulatorToolbox.hh"
39 #include "StringTools.hh"
40 #include "Program.hh"
41 #include "Procedure.hh"
42 #include "Breakpoint.hh"
43 #include "StopPointManager.hh"
44 #include "Conversion.hh"
45 #include "TclConditionScript.hh"
46 #include "ExpressionScript.hh"
47 #include "TclInterpreter.hh"
48 #include "GlobalScope.hh"
49 #include "CodeLabel.hh"
50 #include "DataLabel.hh"
51 #include "AddressSpace.hh"
52 #include "NullAddressSpace.hh"
53 
54 using namespace TTAProgram;
55 
56 ///////////////////////////////////////////////////////////////////////////////
57 // SimControlLanguageCommand
58 ///////////////////////////////////////////////////////////////////////////////
59 
60 /**
61  * Constructor.
62  *
63  * Sets the name of the command to the base class.
64  *
65  * @param name Name of the command to add.
66  */
68  const std::string& name) :
69  CustomCommand(name) {
70 }
71 
72 /**
73  * Destructor.
74  *
75  * Does nothing.
76  */
78 }
79 
80 /**
81  * Checks that the simulation is initialized and ready to run.
82  *
83  * Sets errors message and returns false if simulation is not initialized.
84  *
85  * @return True if simulation is initialized.
86  */
87 bool
89 
90  DataObject* result = new DataObject();
91  if (!simulatorFrontend().isSimulationInitialized()) {
92  result->setString(
95  interpreter()->setResult(result);
96  return false;
97  }
98 
99  interpreter()->setResult(result);
100  return true;
101 }
102 
103 /**
104  * Checks that the simulation is not already running.
105  *
106  * Sets errors message and returns false if simulation is running.
107  *
108  * @return True if simulation is not running.
109  */
110 bool
112 
113  DataObject* result = new DataObject();
114  if (simulatorFrontend().isSimulationRunning() ||
115  simulatorFrontend().isSimulationStopped()) {
116  result->setString(
119  interpreter()->setResult(result);
120  return false;
121  }
122  interpreter()->setResult(result);
123  return true;
124 }
125 
126 /**
127  * Checks that the simulation is stopped.
128  *
129  * Sets errors message and returns false if simulation is not stopped by
130  * the user.
131  *
132  * @return True if simulation is stopped.
133  */
134 bool
136 
137  DataObject* result = new DataObject();
138  if (!simulatorFrontend().isSimulationStopped()) {
139  result->setString(
142  interpreter()->setResult(result);
143  return false;
144  }
145 
146  interpreter()->setResult(result);
147  return true;
148 }
149 
150 /**
151  * Checks that the simulation has ended.
152  *
153  * Sets errors message and returns false if simulation has not ended.
154  *
155  * @return True if simulation has ended.
156  */
157 bool
159 
160  DataObject* result = new DataObject();
161  if (!simulatorFrontend().hasSimulationEnded()) {
162  result->setString(
165  interpreter()->setResult(result);
166  return false;
167  }
168 
169  interpreter()->setResult(result);
170  return true;
171 }
172 
173 
174 /**
175  * Checks that the simulated program has been loaded successfully.
176  *
177  * @return True if program has been loaded.
178  */
179 bool
181 
182  if (!simulatorFrontend().isProgramLoaded()) {
186 
187  return false;
188  }
189  return true;
190 }
191 
192 
193 /**
194  * Checks that the simulated machine has been loaded successfully.
195  *
196  * @return True if machine has been loaded.
197  */
198 bool
200  if (!simulatorFrontend().isMachineLoaded()) {
201  interpreter()->setError(std::string("No machine loaded."));
202  return false;
203  }
204  return true;
205 }
206 
207 
208 /**
209  * Returns the SimulatorFrontend instance stored in the context.
210  *
211  * @return The SimulatorFrontend instance.
212  */
215 
216  assert(interpreter() != NULL);
217 
218  SimulatorInterpreterContext& interpreterContext =
219  dynamic_cast<SimulatorInterpreterContext&>(interpreter()->context());
220 
221  return interpreterContext.simulatorFrontend();
222 }
223 
224 /**
225  * Prints the next simulated instruction to the simulator console.
226  */
227 void
229 
230  if (simulatorFrontend().nextInstructionPrinting())
232  << std::endl;
233 }
234 
235 /**
236  * Prints information that should be printed after simulation is stopped.
237  *
238  * These should be printed when the control is returned back to user
239  * after running simulation with "run" or "resume" commands and being
240  * stopped due to simulation finish or a breakpoint.
241  */
242 void
244 
248 }
249 
250 /**
251  * Prints the reasons why simulation has been stopped.
252  *
253  * @todo the stop reason code to string conversion should be externalized
254  * to another function.
255  */
256 void
258  for (unsigned int i = 0; i < simulatorFrontend().stopReasonCount(); ++i) {
259  switch (simulatorFrontend().stopReason(i)) {
260  case SRE_AFTER_STEPPING:
261  outputStream()
263  Texts::TXT_STOPREASON_STEPPING).str() << std::endl;
264  break;
265  case SRE_AFTER_UNTIL:
266  outputStream()
268  Texts::TXT_STOPREASON_UNTIL).str() << std::endl;
269  break;
270  case SRE_AFTER_TIMEOUT:
271  outputStream()
273  Texts::TXT_STOPREASON_TIMEOUT).str() << std::endl;
274  break;
275  case SRE_USER_REQUESTED:
276  outputStream()
278  Texts::TXT_STOPREASON_USERREQUEST).str() << std::endl;
279  break;
280  case SRE_RUNTIME_ERROR:
281  outputStream()
283  Texts::TXT_STOPREASON_RUNTIME_ERROR).str() << std::endl;
284  break;
285  case SRE_BREAKPOINT: {
286  StopPointManager& stopPointManager =
288  for (unsigned int i = 0;
289  i < stopPointManager.stopCausingStopPointCount(); ++i) {
290  try {
291  // test that the breakpoint is not deleted
292  stopPointManager.stopPointWithHandleConst(
293  stopPointManager.stopCausingStopPoint(i));
294  outputStream()
297  stopPointManager.stopCausingStopPoint(i)).str()
298  << std::endl;
299  } catch (const InstanceNotFound&) {
300  outputStream()
303  << std::endl;
304  }
305  }
306  break;
307  }
308  default:
309  outputStream()
310  << "Stopped because of an unknown reason." << std::endl;
311  break;
312  }
313  }
314 }
315 
316 /**
317  * Prints the simulation time in minutes and seconds in case it's enabled.
318  *
319  * Also prints out the frequency in MHz
320  */
321 void
323 
324  if (!simulatorFrontend().simulationTimeStatistics())
325  return;
326 
328  double time = simulatorFrontend().lastRunTime();
329 
330  double minutes = 0.0;
331  double seconds = modf(time / 60.0 , &minutes) * 60.0;
332  double frequency = (static_cast<double>(cycleCount) / time) / 1000000;
333 
334 
335  outputStream()
336  << minutes << " min "
337  << seconds << " s "
338  << frequency << " MHz" << std::endl;
339 }
340 
341 /**
342  * Returns the output stream which can be used to print information to
343  * the user.
344  *
345  * Uses the same output stream as the linereader to make the information
346  * texts printed to the same stream as confirmations of the linereader.
347  *
348  * @return The output stream.
349  */
350 std::ostream&
352  return interpreter()->lineReader()->outputStream();
353 }
354 
355 /**
356  * Parses an instruction address expression string.
357  *
358  * Expression string can be given by the user to, for example, 'break' or
359  * 'until' commands. This function also does range checking, when the address
360  * is lower than the first address of the program, it sets the address to the
361  * lowest address, when the address is bigger than the last address of the
362  * program, it sets the address to the last address.
363  *
364  * Supported address expression strings are currently:
365  *
366  * [empty] Address of the instruction following the current
367  * instruction.
368  * *address An absolute instruction address reference, can be
369  * an integer or a label string.
370  *
371  *
372  * @param expression The expression to parse.
373  * @return The parsed instruction address.
374  * @exception IllegalParameters when expression could not be parsed to
375  * an address.
376  */
379  const std::string& expression) {
380  std::string expr = StringTools::trim(expression);
381  const std::string errorMessage = "Illegal argument.";
382 
383  InstructionAddress theAddress = 0;
384  if (expr.size() == 0) {
385  theAddress = simulatorFrontend().programCounter() + 1;
386  } else {
387  // the argument is an absolute address, try to evaluate it to an
388  // instruction address
389 
390  // check if it's an integer, that is, a direct instruction address
391  // reference
392  const std::string address = expression;
393  try {
394  theAddress = Conversion::toUnsignedInt(address);
395  } catch (const NumberFormatException&) {
396  // check if a label with given string is found in the
397  // global scope
398  const GlobalScope& globalScope =
400 
401  try {
402  theAddress =
403  globalScope.codeLabel(address).address().location();
404  } catch (const KeyNotFound&) {
405  try {
406  // check if it's a reference to a function
407  theAddress =
408  simulatorFrontend().program().procedure(address).
409  startAddress().location();
410  } catch (const KeyNotFound&) {
411  try {
412  // check if user forgot the leading "_"
413  theAddress =
415  std::string("_") + address).
416  startAddress().location();
417  } catch (const KeyNotFound&) {
418  // couldn't evaluate the label
422 
423  throw IllegalParameters(
424  __FILE__, __LINE__, __func__, errorMessage);
425  }
426  }
427  }
428  }
429  }
430 
431  // check the boundaries of the instruction address and fix it, if necessary
432  const InstructionAddress programLastAddress =
434  - 1;
435 
436  const InstructionAddress programFirstAddress =
438  location();
439 
440  if (theAddress > programLastAddress) {
441  theAddress = programLastAddress;
442  } else if (theAddress < programFirstAddress) {
443  theAddress = programFirstAddress;
444  }
445 
446  return theAddress;
447 }
448 
449 /**
450  * Parses a data address expression string.
451  *
452  * Expression string can be given by the user to, for example, 'x' command.
453  * Resolves symbol.
454  *
455  * Supported address expression strings are currently:
456  *
457  * *address An absolute address reference, can be
458  * an integer or a label string. In case of a label
459  * string, the return value contains also the address
460  * space of the address expression.
461  *
462  *
463  * @param expression The expression to parse.
464  * @return The parsed instruction address and its address space, if given.
465  * In case address space could not be found, the address space
466  * field points to NullAddressSpace.
467  * @exception IllegalParameters when expression could not be parsed to
468  * an address.
469  */
472  const std::string& expression) {
473  std::string expr = StringTools::trim(expression);
474  const std::string errorMessage = "Illegal argument.";
475 
476  InstructionAddress theAddress = 0;
477 
478  // check if it's an integer, that is, a direct address reference
479  const std::string addressString = expression;
480  try {
481  theAddress = Conversion::toUnsignedInt(expression);
482  } catch (const NumberFormatException&) {
483  // it was not an integer, check if a label with given string
484  // is found in the global scope
485  const GlobalScope& globalScope =
487 
488  try {
489  return globalScope.dataLabel(expression).address();
490  } catch (const KeyNotFound&) {
491  // couldn't evaluate the label
495  throw IllegalParameters(
496  __FILE__, __LINE__, __func__, errorMessage);
497  }
498  }
499  return Address(theAddress, TTAMachine::NullAddressSpace::instance());
500 }
501 
502 /**
503  * Prompts for a condition script from the user.
504  *
505  * Also test runs the condition script. Returns false and sets interpreter
506  * error if the entered condition is illegal. If an empty condition script
507  * is entered, the condition script is set to always true "1" condition.
508  *
509  * @param target The target to put the condition script in.
510  * @return false in case the script produces error when executed.
511  */
512 bool
514 
515  std::string conditionScript =
517  interpreter()->lineReader()->readLine(
520 
521  if (StringTools::trim(conditionScript) == "") {
522  conditionScript = "1";
523  }
524 
525  TclConditionScript testCondition(
526  dynamic_cast<TclInterpreter*>(interpreter()), conditionScript);
527 
528  // try the condition
529  try {
530  testCondition.execute();
531  interpreter()->setResult("");
532  target = testCondition;
533  } catch (const ScriptExecutionFailure& sef) {
534  interpreter()->setError(true);
535  return false;
536  }
537  return true;
538 }
539 
540 /**
541  * Prompts for an expression script from the user.
542  *
543  * Also test runs the expression script. Returns false and sets interpreter
544  * error if the entered expression is illegal. If an empty expression script
545  * is entered, returns false and sets interpreter error.
546  *
547  * @param target The target to put the expression script in.
548  * @return false in case the script produces error when executed or it's empty.
549  */
550 bool
552 
553  std::string expressionScript =
555  interpreter()->lineReader()->readLine(
558 
559  if (StringTools::trim(expressionScript) == "") {
563  return false;
564  }
565 
566  ExpressionScript testExpression(
567  dynamic_cast<TclInterpreter*>(interpreter()), expressionScript);
568 
569  // try the condition
570  try {
571  testExpression.execute();
572  interpreter()->setResult("");
573  target = testExpression;
574  return true;
575  } catch (const ScriptExecutionFailure& sef) {
576  interpreter()->setError(true);
577  return false;
578  }
579 }
580 
581 /**
582  * Parses breakpoint data from the given arguments.
583  *
584  * This is a refactoring of common functionality used in 'bp' and 'tbp'
585  * commands. Sets the error message to the interpreter and returns false
586  * if there was an error while parsing or simulation is in wrong state.
587  *
588  * @param arguments as passed to the execute() of the command.
589  * @param target the breakpoint instance to put the parsed data to.
590  * @return true if the breakpoint was parsed succesfully.
591  */
592 bool
594  const std::vector<DataObject>& arguments, Breakpoint& target) {
595 
597  return false;
598  }
599 
600  // how many arguments there are in the condition part
601  size_t conditionArgumentCount = 0;
602  for (size_t i = 0; i < arguments.size(); ++i) {
603  if (StringTools::stringToLower(arguments[i].stringValue()) ==
604  "if") {
605 
606  if (i != arguments.size() - 1) {
610  return false;
611  }
612  conditionArgumentCount = 1;
613  break;
614  }
615  }
616 
617  if (conditionArgumentCount > 0) {
618  TclConditionScript condition(NULL, "");
619  if (!askConditionFromUser(condition)) {
620  return false;
621  }
622  assert(condition.script().size() > 0);
623  if (condition.script().at(0) == "1") {
624  target.removeCondition();
625  } else {
626  target.setCondition(condition);
627  }
628  }
629 
630  const int argumentsBeforeCondition =
631  arguments.size() - 1 - conditionArgumentCount;
632 
633  InstructionAddress theAddress = 0;
634 
635  if (argumentsBeforeCondition == 0 || argumentsBeforeCondition == 1) {
636 
637  const std::string argument =
638  ((argumentsBeforeCondition == 0)?
639  (""):(arguments[1].stringValue()));
640  try {
641  theAddress =
643  } catch (const IllegalParameters&) {
644  // the helper function has set the error string to
645  // the interpreter
646  return false;
647  }
648 
649  } else {
653  return false;
654  }
655 
656  /// @todo set the condition, if any
657 
658  target.setAddress(theAddress);
659  return true;
660 }
661 
662 
663 /// widths of the columns of the break point info table
664 /// widths don't include the spaces between columns
665 /// the handle id column width
667 
668 /**
669  * Prints information of a breakpoint.
670  *
671  * If breakpoint with the given handle could not be found, sets error
672  * to the interpreter and returns false.
673  *
674  * @param breakpointHandle The handle of the breakpoint to be printed.
675  * @return true If breakpoint could be printed.
676  */
677 bool
679  unsigned int breakpointHandle) {
680 
681  try {
682  const StopPoint& stopPoint =
684  breakpointHandle);
685 
686  outputStream()
687  << std::right << std::setw(BPINFO_HANDLE_COL_WIDTH)
688  << breakpointHandle << ": " << stopPoint.description()
689  << std::endl;
690 
691  return true;
692  } catch (const InstanceNotFound&) {
696  return false;
697  }
698 }
699 
700 /**
701  * Verifies that the list of breakpoint ids are valid breakpoint handles.
702  *
703  * A refactoring for error checking of the {enable,disable,delete}bp
704  * commands. Sets interpreter error in case invalid handles are found
705  * and returns false.
706  *
707  * @param arguments The arguments as given to the execute() of the command.
708  * @param startIndex The first argument to check.
709  * @return true if all handles are valid.
710  */
711 bool
713  const std::vector<DataObject>& arguments,
714  std::size_t startIndex) {
715 
716  // verify that the breakpoints are found
717  for (size_t i = startIndex; i < arguments.size(); ++i) {
718  if (!checkPositiveIntegerArgument(arguments[i])) {
719  return false;
720  }
721  const unsigned int breakpointHandle = arguments[i].integerValue();
722  try {
723  StopPointManager& stopPointManager =
725  // just check that breakpoint is found with the handle
726  stopPointManager.stopPointWithHandleConst(breakpointHandle);
727  } catch (const InstanceNotFound&) {
731  return false;
732  }
733  }
734  return true;
735 }
736 
737 void
739  DataObject* errorMessage = new DataObject();
740  errorMessage->setString(errorMsg);
741  interpreter()->setResult(errorMessage);
742 }
743 
744 /**
745  * Parses the address string to corresponding memory address and address space.
746  *
747  * @param addressString Memory address command string to parse.
748  * @param addressSpaceName Address space name to be set.
749  * @param memoryAddress Memory address to be set.
750  * @return true on success.
751  */
752 bool
754  const std::string& addressString,
755  std::string& addressSpaceName,
756  std::size_t& memoryAddress) {
757 
758  try {
759  const TTAProgram::Address& parsedAddress =
760  parseDataAddressExpression(addressString);
761  if (&parsedAddress.space() !=
763  addressSpaceName = parsedAddress.space().name();
764  }
765  memoryAddress = parsedAddress.location();
766  } catch(const IllegalParameters& n) {
767  return false;
768  }
769  return true;
770 }
771 
772 /**
773  * Sets memory instance from a given AddressSpaceName to given memory.
774  *
775  * @param memory Memory pointer to be set
776  * @param addressSpaceName The name of the address space.
777  * @return true on success.
778  */
779 bool
781  MemorySystem::MemoryPtr& memory,
782  const std::string& addressSpaceName) {
783 
784  if (simulatorFrontend().memorySystem().memoryCount() < 1) {
788  return false;
789  } else if (simulatorFrontend().memorySystem().memoryCount() == 1) {
790  memory = simulatorFrontend().memorySystem().memory(0);
791  } else {
792  /// must have the address space defined
793  if (addressSpaceName == "") {
797  return false;
798  }
799  try {
800  memory =
801  simulatorFrontend().memorySystem().memory(addressSpaceName);
802  } catch (const InstanceNotFound&) {
806  return false;
807  }
808  }
809  return true;
810 }
811 
812 
813 ///////////////////////////////////////////////////////////////////////////////
814 // SimControlLanguageSubCommand
815 ///////////////////////////////////////////////////////////////////////////////
816 
817 /**
818  * Constructor.
819  *
820  * @param parentCommand The main command this is a subcommand for.
821  * @param minArgs The minimum count of arguments this command should receive.
822  * @param maxArgs The maximum count of arguments this command should receive.
823  */
825  SimControlLanguageCommand& parentCommand) :
826  parentCommand_(parentCommand) {
827 }
828 
829 /**
830  * Destructor.
831  *
832  */
834 }
835 
836 /**
837  * Returns the parent command.
838  *
839  * @return the parent command.
840  */
843  return parentCommand_;
844 }
845 
SimControlLanguageSubCommand::~SimControlLanguageSubCommand
virtual ~SimControlLanguageSubCommand()
Definition: SimControlLanguageCommand.cc:833
TTAMachine::NullAddressSpace::instance
static NullAddressSpace & instance()
Definition: NullAddressSpace.cc:62
Script::execute
virtual DataObject execute()
Definition: Script.cc:82
StopPointManager.hh
TTAProgram
Definition: Estimator.hh:65
SimulatorInterpreterContext
Definition: SimulatorInterpreterContext.hh:45
SimControlLanguageSubCommand::parent
virtual SimControlLanguageCommand & parent()
Definition: SimControlLanguageCommand.cc:842
TclConditionScript.hh
Texts::TXT_BREAKPOINT_NOT_FOUND
@ TXT_BREAKPOINT_NOT_FOUND
Definition: SimulatorTextGenerator.hh:186
TTAProgram::Scope::codeLabel
const CodeLabel & codeLabel(const std::string &name) const
Definition: Scope.cc:233
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
Breakpoint::setAddress
virtual void setAddress(InstructionAddress newAddress)
Definition: Breakpoint.cc:96
SimControlLanguageSubCommand::SimControlLanguageSubCommand
SimControlLanguageSubCommand(SimControlLanguageCommand &parentCommand)
Definition: SimControlLanguageCommand.cc:824
SimControlLanguageCommand::outputStream
virtual std::ostream & outputStream()
Definition: SimControlLanguageCommand.cc:351
SimControlLanguageCommand::checkSimulationStopped
bool checkSimulationStopped()
Definition: SimControlLanguageCommand.cc:135
SimControlLanguageCommand::checkSimulationNotAlreadyRunning
bool checkSimulationNotAlreadyRunning()
Definition: SimControlLanguageCommand.cc:111
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
NumberFormatException
Definition: Exception.hh:421
SimulatorFrontend::program
const TTAProgram::Program & program() const
Definition: SimulatorFrontend.cc:276
SimulatorInterpreterContext.hh
TTAProgram::Address
Definition: Address.hh:51
TTAProgram::Program::firstProcedure
Procedure & firstProcedure() const
Definition: Program.cc:213
Texts::TXT_STOPREASON_BREAKPOINT
@ TXT_STOPREASON_BREAKPOINT
Stop reason: breakpoint.
Definition: SimulatorTextGenerator.hh:170
SRE_USER_REQUESTED
@ SRE_USER_REQUESTED
User requested the simulation to stop explicitly, e.g., by pressing ctrl-c in the CLI.
Definition: SimulatorConstants.hh:66
Texts::TXT_STOPREASON_DELETED_BREAKPOINT
@ TXT_STOPREASON_DELETED_BREAKPOINT
Stop reason: temporary breakpoint.
Definition: SimulatorTextGenerator.hh:172
DataObject
Definition: DataObject.hh:50
SRE_AFTER_TIMEOUT
@ SRE_AFTER_TIMEOUT
Stopped after simulation timeout instruction.
Definition: SimulatorConstants.hh:63
Breakpoint
Definition: Breakpoint.hh:50
SimControlLanguageCommand::setMemoryPointer
bool setMemoryPointer(MemorySystem::MemoryPtr &memory, const std::string &addressSpaceName)
Definition: SimControlLanguageCommand.cc:780
SimControlLanguageCommand::parseDataAddressExpression
TTAProgram::Address parseDataAddressExpression(const std::string &expression)
Definition: SimControlLanguageCommand.cc:471
TclInterpreter
Definition: TclInterpreter.hh:52
Procedure.hh
SimControlLanguageCommand::printNextInstruction
virtual void printNextInstruction()
Definition: SimControlLanguageCommand.cc:228
Texts::TXT_ADDRESS_SPACE_NOT_FOUND
@ TXT_ADDRESS_SPACE_NOT_FOUND
Definition: SimulatorTextGenerator.hh:193
ExpressionScript
Definition: ExpressionScript.hh:44
Texts::TXT_EXPRESSION_EMPTY
@ TXT_EXPRESSION_EMPTY
Definition: SimulatorTextGenerator.hh:189
AddressSpace.hh
CustomCommand::checkPositiveIntegerArgument
bool checkPositiveIntegerArgument(const DataObject &argument)
Definition: CustomCommand.cc:134
TTAProgram::Address::space
const TTAMachine::AddressSpace & space() const
SimControlLanguageCommand::checkProgramLoaded
bool checkProgramLoaded()
Definition: SimControlLanguageCommand.cc:180
SimulatorInterpreterContext::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimulatorInterpreterContext.cc:61
TTAProgram::CodeSnippet::startAddress
virtual Address startAddress() const
Definition: CodeSnippet.cc:780
TclConditionScript
Definition: TclConditionScript.hh:50
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
DataLabel.hh
TTAProgram::CodeLabel::address
virtual Address address() const
Definition: CodeLabel.cc:101
Texts::TXT_STOPREASON_USERREQUEST
@ TXT_STOPREASON_USERREQUEST
Stop reason: user requested.
Definition: SimulatorTextGenerator.hh:180
SimulatorFrontend::stopReasonCount
unsigned int stopReasonCount() const
Definition: SimulatorFrontend.cc:1344
SimControlLanguageCommand::printStopReasons
virtual void printStopReasons()
Definition: SimControlLanguageCommand.cc:257
Texts::TXT_INTERP_ENTER_CONDITION_PROMPT
@ TXT_INTERP_ENTER_CONDITION_PROMPT
Definition: SimulatorTextGenerator.hh:187
SimControlLanguageCommand::setMemoryAddress
bool setMemoryAddress(const std::string &addressString, std::string &addressSpaceName, std::size_t &memoryAddress)
Definition: SimControlLanguageCommand.cc:753
MemorySystem::MemoryPtr
boost::shared_ptr< Memory > MemoryPtr
Definition: MemorySystem.hh:57
GlobalScope.hh
SimControlLanguageCommand::verifyBreakpointHandles
bool verifyBreakpointHandles(const std::vector< DataObject > &arguments, std::size_t startIndex=1)
Definition: SimControlLanguageCommand.cc:712
SimControlLanguageCommand::setErrorMessage
void setErrorMessage(const TCEString &errorMsg)
Definition: SimControlLanguageCommand.cc:738
TTAProgram::Program::globalScopeConst
const GlobalScope & globalScopeConst() const
Definition: Program.cc:192
StringTools.hh
assert
#define assert(condition)
Definition: Application.hh:86
SimulatorFrontend::programCounter
InstructionAddress programCounter() const
Definition: SimulatorFrontend.cc:1169
SimControlLanguageCommand::checkSimulationEnded
bool checkSimulationEnded()
Definition: SimControlLanguageCommand.cc:158
SimControlLanguageCommand::printStopInformation
virtual void printStopInformation()
Definition: SimControlLanguageCommand.cc:243
SimControlLanguageCommand::SimControlLanguageCommand
SimControlLanguageCommand(const std::string &name)
Definition: SimControlLanguageCommand.cc:67
StopPointManager::stopCausingStopPoint
unsigned int stopCausingStopPoint(unsigned int index) const
Definition: StopPointManager.cc:345
Texts::TXT_STOPREASON_RUNTIME_ERROR
@ TXT_STOPREASON_RUNTIME_ERROR
Stop reason: user requested.
Definition: SimulatorTextGenerator.hh:182
SimulatorToolbox.hh
BPINFO_HANDLE_COL_WIDTH
const int BPINFO_HANDLE_COL_WIDTH
widths of the columns of the break point info table widths don't include the spaces between columns t...
Definition: SimControlLanguageCommand.cc:666
SimControlLanguageCommand::~SimControlLanguageCommand
virtual ~SimControlLanguageCommand()
Definition: SimControlLanguageCommand.cc:77
IllegalParameters
Definition: Exception.hh:113
Texts::TXT_INTERP_SIMULATION_NOT_RUNNING
@ TXT_INTERP_SIMULATION_NOT_RUNNING
Text to be printed when simulation is not running and it should be.
Definition: SimulatorTextGenerator.hh:137
StopPointManager::stopPointWithHandleConst
const StopPoint & stopPointWithHandleConst(unsigned int handle) const
Definition: StopPointManager.cc:248
Texts::TXT_INTERP_ENTER_EXPRESSION_PROMPT
@ TXT_INTERP_ENTER_EXPRESSION_PROMPT
Definition: SimulatorTextGenerator.hh:188
StopPoint
Definition: StopPoint.hh:53
SimControlLanguageSubCommand::parentCommand_
SimControlLanguageCommand & parentCommand_
the main command
Definition: SimControlLanguageCommand.hh:130
SimControlLanguageCommand::parseInstructionAddressExpression
InstructionAddress parseInstructionAddressExpression(const std::string &expression)
Definition: SimControlLanguageCommand.cc:378
Conversion.hh
SimControlLanguageCommand::askConditionFromUser
bool askConditionFromUser(TclConditionScript &target)
Definition: SimControlLanguageCommand.cc:513
StopPointManager
Definition: StopPointManager.hh:50
Texts::TXT_STOPREASON_STEPPING
@ TXT_STOPREASON_STEPPING
Stop reason: stepping.
Definition: SimulatorTextGenerator.hh:178
Texts::TXT_INTERP_SIMULATION_NOT_INITIALIZED
@ TXT_INTERP_SIMULATION_NOT_INITIALIZED
Text to be printed when simulation is not initialized and it should be.
Definition: SimulatorTextGenerator.hh:131
Texts::TXT_LABEL_NOT_FOUND
@ TXT_LABEL_NOT_FOUND
Definition: SimulatorTextGenerator.hh:184
Texts::TXT_ILLEGAL_ARGUMENTS
@ TXT_ILLEGAL_ARGUMENTS
Definition: TextGenerator.hh:67
NullAddressSpace.hh
Texts::TXT_STOPREASON_UNTIL
@ TXT_STOPREASON_UNTIL
Stop reason: until.
Definition: SimulatorTextGenerator.hh:174
__func__
#define __func__
Definition: Application.hh:67
SimulatorToolbox::textGenerator
static SimulatorTextGenerator & textGenerator()
Definition: SimulatorToolbox.cc:75
Breakpoint.hh
Texts::TXT_NO_PROGRAM_LOADED
@ TXT_NO_PROGRAM_LOADED
Definition: SimulatorTextGenerator.hh:202
StopPointManager::stopCausingStopPointCount
unsigned int stopCausingStopPointCount() const
Definition: StopPointManager.cc:368
CustomCommand
Definition: CustomCommand.hh:54
Texts::TXT_INTERP_SIMULATION_NOT_ENDED
@ TXT_INTERP_SIMULATION_NOT_ENDED
Text to be printed when simulation has not ended and it should be.
Definition: SimulatorTextGenerator.hh:140
TTAProgram::GlobalScope
Definition: GlobalScope.hh:47
TTAProgram::Address::location
InstructionAddress location() const
SRE_RUNTIME_ERROR
@ SRE_RUNTIME_ERROR
A fatal runtime error occured in the simulated program.
Definition: SimulatorConstants.hh:68
SRE_BREAKPOINT
@ SRE_BREAKPOINT
Stopped because of at least one breakpoint.
Definition: SimulatorConstants.hh:65
SimControlLanguageCommand::checkSimulationInitialized
bool checkSimulationInitialized()
Definition: SimControlLanguageCommand.cc:88
SRE_AFTER_UNTIL
@ SRE_AFTER_UNTIL
Stopped after running to the wanted.
Definition: SimulatorConstants.hh:62
SimulatorFrontend.hh
TTAProgram::Label::address
virtual Address address() const
Definition: Label.cc:84
SimControlLanguageCommand::checkMachineLoaded
bool checkMachineLoaded()
Definition: SimControlLanguageCommand.cc:199
TclConditionScript::script
virtual std::vector< std::string > script() const
Definition: TclConditionScript.cc:70
LineReader::outputStream
virtual std::ostream & outputStream()
Definition: LineReader.cc:102
CustomCommand::interpreter
ScriptInterpreter * interpreter() const
Texts::TXT_NO_ADDRESS_SPACE_GIVEN
@ TXT_NO_ADDRESS_SPACE_GIVEN
Definition: SimulatorTextGenerator.hh:197
ScriptInterpreter::setResult
virtual void setResult(DataObject *result)
Definition: ScriptInterpreter.cc:128
StringTools::trim
static std::string trim(const std::string &source)
Definition: StringTools.cc:55
Conversion::toUnsignedInt
static unsigned int toUnsignedInt(const T &source)
Texts::TXT_INTERP_SIMULATION_ALREDY_RUNNING
@ TXT_INTERP_SIMULATION_ALREDY_RUNNING
Text to be printed when simulation is already running and it should not be.
Definition: SimulatorTextGenerator.hh:134
TclInterpreter.hh
SimControlLanguageCommand::parseBreakpoint
bool parseBreakpoint(const std::vector< DataObject > &arguments, Breakpoint &target)
Definition: SimControlLanguageCommand.cc:593
SimulatorFrontend::memorySystem
MemorySystem & memorySystem(int coreId=-1)
Definition: SimulatorFrontend.cc:2121
Program.hh
ScriptExecutionFailure
Definition: Exception.hh:657
TCEString
Definition: TCEString.hh:53
SRE_AFTER_STEPPING
@ SRE_AFTER_STEPPING
Stopped after stepping the given count.
Definition: SimulatorConstants.hh:61
SimulatorFrontend::lastRunCycleCount
CycleCount lastRunCycleCount() const
Definition: SimulatorFrontend.cc:2276
MemorySystem::memory
MemoryPtr memory(const TTAMachine::AddressSpace &as)
Definition: MemorySystem.cc:170
TTAProgram::Scope::dataLabel
const DataLabel & dataLabel(const std::string &name) const
Definition: Scope.cc:251
SimulatorFrontend::stopReason
StopReason stopReason(unsigned int index) const
Definition: SimulatorFrontend.cc:1356
SimulatorFrontend::lastRunTime
double lastRunTime() const
Definition: SimulatorFrontend.cc:2289
TTAProgram::CodeSnippet::endAddress
virtual Address endAddress() const
Definition: CodeSnippet.cc:788
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
SimulatorFrontend::programLocationDescription
std::string programLocationDescription() const
Definition: SimulatorFrontend.cc:1108
StopPoint::removeCondition
virtual void removeCondition()
Definition: StopPoint.cc:142
ScriptInterpreter::setError
virtual void setError(bool state)
Definition: ScriptInterpreter.cc:205
KeyNotFound
Definition: Exception.hh:285
Texts::TXT_STOPREASON_TIMEOUT
@ TXT_STOPREASON_TIMEOUT
Stop reason: timeout
Definition: SimulatorTextGenerator.hh:176
StopPoint::description
virtual std::string description() const =0
Definition: StopPoint.cc:239
TTAProgram::Program::lastProcedure
Procedure & lastProcedure() const
Definition: Program.cc:230
SimControlLanguageCommand
Definition: SimControlLanguageCommand.hh:63
SimControlLanguageCommand.hh
DataObject::setString
virtual void setString(std::string value)
Definition: DataObject.cc:130
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214
TTAProgram::Program::procedure
Procedure & procedure(int index) const
Definition: Program.cc:622
SimulatorFrontend
Definition: SimulatorFrontend.hh:89
ScriptInterpreter::lineReader
virtual LineReader * lineReader() const
Definition: ScriptInterpreter.cc:367
ScriptInterpreter::context
virtual InterpreterContext & context() const =0
CodeLabel.hh
StopPoint::setCondition
virtual void setCondition(const ConditionScript &condition)
Definition: StopPoint.cc:131
StringTools::stringToLower
static std::string stringToLower(const std::string &source)
Definition: StringTools.cc:160
SimulatorFrontend::stopPointManager
StopPointManager & stopPointManager()
Definition: SimulatorFrontend.cc:2108
InstanceNotFound
Definition: Exception.hh:304
SimControlLanguageCommand::printBreakpointInfo
virtual bool printBreakpointInfo(unsigned int breakpointHandle)
Definition: SimControlLanguageCommand.cc:678
ExpressionScript.hh
SimControlLanguageCommand::askExpressionFromUser
bool askExpressionFromUser(ExpressionScript &target)
Definition: SimControlLanguageCommand.cc:551
SimControlLanguageCommand::printSimulationTime
virtual void printSimulationTime()
Definition: SimControlLanguageCommand.cc:322