OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BackTraceCommand Class Reference

#include <BackTraceCommand.hh>

Inheritance diagram for BackTraceCommand:
Inheritance graph
Collaboration diagram for BackTraceCommand:
Collaboration graph

Public Member Functions

 BackTraceCommand ()
 
virtual ~BackTraceCommand ()
 
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 back trace command of the Simulator Control Language.

Definition at line 47 of file BackTraceCommand.hh.

Constructor & Destructor Documentation

◆ BackTraceCommand()

BackTraceCommand::BackTraceCommand ( )

◆ ~BackTraceCommand()

BackTraceCommand::~BackTraceCommand ( )
virtual

Definition at line 43 of file BackTraceCommand.cc.

43 {
44}

Member Function Documentation

◆ execute()

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

Implements CustomCommand.

Definition at line 47 of file BackTraceCommand.cc.

47 {
48 if (!checkArgumentCount(arguments.size() - 1, 0, 0)) {
49 return false;
50 }
51
53 return false;
54 }
55
56 SimulatorInterpreterContext& interpreterContext =
58
60 interpreterContext.simulatorFrontend();
61
64 "Call history logging not enabled.\n"
65 "Use 'setting call_history_length' to enable.");
66 return false;
67 }
68
70
71#if 0
72 // move this to a separate call_path command or similar
73 const CallPathTracker::ProcedureTransferQueue& callHistory =
74 cpt.transfers();
75
76 for (CallPathTracker::ProcedureTransferQueue::const_iterator i =
77 callHistory.begin(); i != callHistory.end(); ++i) {
79 TCEString procName =
80 dynamic_cast<const TTAProgram::Procedure&>(
82 parent()).name();
83 if (tr.isEntry) {
85 << "called ";
86 } else {
88 << "returned to ";
89 }
91 << procName << "@" << tr.sourceAddress << std::endl;
92 }
93#endif
94
96 cpt.backTrace();
97 int callLevel = 0;
98 CallPathTracker::ProcedureTransferQueue::const_iterator i =
99 calls.begin();
100 for (; i != calls.end(); ++i) {
102 TCEString procName =
103 dynamic_cast<const TTAProgram::Procedure&>(
105 parent()).name();
106 assert(tr.isEntry);
107 outputStream()
108 << "#" << callLevel << " called "
109 << procName << "@" << tr.sourceAddress << std::endl;
110 ++callLevel;
111 }
112
113 return true;
114}
#define assert(condition)
std::deque< ProcedureTransfer > ProcedureTransferQueue
const ProcedureTransferQueue & transfers() const
const ProcedureTransferQueue backTrace() const
bool checkArgumentCount(int argumentCount, int minimum, int maximum)
std::string name() const
ScriptInterpreter * interpreter() const
virtual InterpreterContext & context() const =0
void setErrorMessage(const TCEString &errorMsg)
virtual std::ostream & outputStream()
std::size_t callHistoryLength() const
const CallPathTracker & callPathTracker(int core=-1) const
const TTAProgram::Program & program() const
Instruction & instructionAt(InstructionAddress address) const
Definition Program.cc:374

References CallPathTracker::ProcedureTransfer::address, assert, CallPathTracker::backTrace(), SimulatorFrontend::callHistoryLength(), SimulatorFrontend::callPathTracker(), CustomCommand::checkArgumentCount(), SimControlLanguageCommand::checkSimulationStopped(), ScriptInterpreter::context(), TTAProgram::Program::instructionAt(), CustomCommand::interpreter(), CallPathTracker::ProcedureTransfer::isEntry, CustomCommand::name(), SimControlLanguageCommand::outputStream(), SimulatorFrontend::program(), SimControlLanguageCommand::setErrorMessage(), SimControlLanguageCommand::simulatorFrontend(), SimulatorInterpreterContext::simulatorFrontend(), CallPathTracker::ProcedureTransfer::sourceAddress, and CallPathTracker::transfers().

Here is the call graph for this function:

◆ helpText()

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

Implements CustomCommand.

Definition at line 117 of file BackTraceCommand.cc.

117 {
118 return std::string(
119 "Prints the current call stack (back trace).\n"
120 "Requires call history saving to be on.\n"
121 "See 'setting call_history_length'.");
122}

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