OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Breakpoint Class Reference

#include <Breakpoint.hh>

Inheritance diagram for Breakpoint:
Inheritance graph
Collaboration diagram for Breakpoint:
Collaboration graph

Public Member Functions

 Breakpoint (SimulatorFrontend &frontend, InstructionAddress address)
 
virtual ~Breakpoint ()
 
virtual bool isTriggered () const
 
virtual std::string description () const
 
virtual StopPointcopy () const
 
virtual InstructionAddress address () const
 
virtual void setAddress (InstructionAddress newAddress)
 
- Public Member Functions inherited from StopPoint
 StopPoint ()
 
virtual ~StopPoint ()
 
virtual void setEnabled (bool flag)
 
virtual bool isEnabled () const
 
virtual void setDisabledAfterTriggered (bool flag)
 
virtual bool isDisabledAfterTriggered () const
 
virtual void setDeletedAfterTriggered (bool flag)
 
virtual bool isDeletedAfterTriggered () const
 
virtual void setCondition (const ConditionScript &condition)
 
virtual void removeCondition ()
 
virtual const ConditionScriptcondition () const
 
virtual bool isConditional () const
 
virtual void setIgnoreCount (unsigned int count)
 
virtual unsigned int ignoreCount () const
 
virtual bool isConditionOK ()
 
virtual void decreaseIgnoreCount ()
 

Private Member Functions

 Breakpoint (const Breakpoint &source)
 Static copying not allowed (should use copy()). More...
 

Private Attributes

InstructionAddress address_
 The address of the breakpoint. A breakpoint is fired when PC equals this address. More...
 
SimulatorFrontendfrontend_
 The simulator frontend which is used to fetch the current PC. More...
 

Additional Inherited Members

- Protected Attributes inherited from StopPoint
bool enabled_
 Tells whether the breakpoint is enabled or disabled. More...
 
bool disabledAfterTriggered_
 Tells if the breakpoint is disabled after it is triggered the next time. More...
 
bool deletedAfterTriggered_
 Tells if the breakpoint is deleted after it is triggered the next time. More...
 
bool conditional_
 Tells whether the breakpoint is conditional or not. More...
 
ConditionScriptcondition_
 The condition which is used to determine whether the breakpoint should be fired or not. More...
 
unsigned int ignoreCount_
 The number of times the condition is to be ignored before enabling the breakpoint. More...
 

Detailed Description

Represents a breakpoint in simulation.

Breakpoint stops simulation when simulation has reached the user set instruction address and general condition for stopping is true.

Definition at line 50 of file Breakpoint.hh.

Constructor & Destructor Documentation

◆ Breakpoint() [1/2]

Breakpoint::Breakpoint ( SimulatorFrontend frontend,
InstructionAddress  address 
)

Constructor.

Parameters
addressThe address.

Definition at line 47 of file Breakpoint.cc.

49  :
50  StopPoint(), address_(address), frontend_(frontend) {
51 }

Referenced by copy().

◆ ~Breakpoint()

Breakpoint::~Breakpoint ( )
virtual

Destructor.

Definition at line 56 of file Breakpoint.cc.

56  {
57 }

◆ Breakpoint() [2/2]

Breakpoint::Breakpoint ( const Breakpoint source)
private

Static copying not allowed (should use copy()).

Member Function Documentation

◆ address()

InstructionAddress Breakpoint::address ( ) const
virtual

Returns the address the breakpoint is watching.

Returns
The address.

Definition at line 86 of file Breakpoint.cc.

86  {
87  return address_;
88 }

References address_.

Referenced by ProximDisassemblyGridTable::GetValue(), ProximBreakpointWindow::onBreakpointLookup(), ProximDisassemblyWindow::onRightClick(), and ProximBreakpointWindow::refreshStopPoints().

◆ copy()

StopPoint * Breakpoint::copy ( ) const
virtual

Copy method for dynamically bound copies.

Implements StopPoint.

Definition at line 63 of file Breakpoint.cc.

63  {
64  StopPoint* aCopy = new Breakpoint(frontend_, address_);
65  if (conditional_) {
66  assert(condition_ != NULL);
67  ConditionScript* conditionCopy = condition_->copy();
68  assert(conditionCopy != NULL);
69  aCopy->setCondition(*conditionCopy);
70  } else {
71  aCopy->removeCondition();
72  }
73  aCopy->setEnabled(enabled_);
77  return aCopy;
78 }

References address_, assert, Breakpoint(), StopPoint::condition_, StopPoint::conditional_, ConditionScript::copy(), StopPoint::deletedAfterTriggered_, StopPoint::disabledAfterTriggered_, StopPoint::enabled_, frontend_, StopPoint::ignoreCount_, StopPoint::removeCondition(), StopPoint::setCondition(), StopPoint::setDeletedAfterTriggered(), StopPoint::setDisabledAfterTriggered(), StopPoint::setEnabled(), and StopPoint::setIgnoreCount().

Here is the call graph for this function:

◆ description()

std::string Breakpoint::description ( ) const
virtual

Prints the description string of the stop point.

Each subclass overrides this method to construct a descripting string of itself.

Implements StopPoint.

Definition at line 120 of file Breakpoint.cc.

120  {
121  return std::string("at address ") + Conversion::toString(address_) +
122  std::string(" ") + StopPoint::description();
123 }

References address_, StopPoint::description(), and Conversion::toString().

Here is the call graph for this function:

◆ isTriggered()

bool Breakpoint::isTriggered ( ) const
virtual

Returns true in case this break point is triggered.

In case the current program counter is the address this break point is watching, and the general condition is ok, this method returns true.

Returns
The status of the breakpoint.

Implements StopPoint.

Definition at line 109 of file Breakpoint.cc.

109  {
110  return frontend_.programCounter() == address_;
111 }

References address_, frontend_, and SimulatorFrontend::programCounter().

Here is the call graph for this function:

◆ setAddress()

void Breakpoint::setAddress ( InstructionAddress  newAddress)
virtual

Sets the address the breakpoint is watching.

Parameters
newAddressThe address.

Definition at line 96 of file Breakpoint.cc.

96  {
97  address_ = newAddress;
98 }

References address_.

Referenced by SimControlLanguageCommand::parseBreakpoint().

Member Data Documentation

◆ address_

InstructionAddress Breakpoint::address_
private

The address of the breakpoint. A breakpoint is fired when PC equals this address.

Definition at line 67 of file Breakpoint.hh.

Referenced by address(), copy(), description(), isTriggered(), and setAddress().

◆ frontend_

SimulatorFrontend& Breakpoint::frontend_
private

The simulator frontend which is used to fetch the current PC.

Definition at line 69 of file Breakpoint.hh.

Referenced by copy(), and isTriggered().


The documentation for this class was generated from the following files:
Breakpoint::frontend_
SimulatorFrontend & frontend_
The simulator frontend which is used to fetch the current PC.
Definition: Breakpoint.hh:69
StopPoint::conditional_
bool conditional_
Tells whether the breakpoint is conditional or not.
Definition: StopPoint.hh:91
Breakpoint::address
virtual InstructionAddress address() const
Definition: Breakpoint.cc:86
StopPoint::setEnabled
virtual void setEnabled(bool flag)
Definition: StopPoint.cc:63
StopPoint::setIgnoreCount
virtual void setIgnoreCount(unsigned int count)
Definition: StopPoint.cc:182
StopPoint::setDisabledAfterTriggered
virtual void setDisabledAfterTriggered(bool flag)
Definition: StopPoint.cc:85
ConditionScript::copy
virtual ConditionScript * copy() const
Definition: ConditionScript.cc:99
StopPoint::enabled_
bool enabled_
Tells whether the breakpoint is enabled or disabled.
Definition: StopPoint.hh:84
Breakpoint::address_
InstructionAddress address_
The address of the breakpoint. A breakpoint is fired when PC equals this address.
Definition: Breakpoint.hh:67
StopPoint::condition_
ConditionScript * condition_
The condition which is used to determine whether the breakpoint should be fired or not.
Definition: StopPoint.hh:94
Conversion::toString
static std::string toString(const T &source)
ConditionScript
Definition: ConditionScript.hh:45
StopPoint::StopPoint
StopPoint()
Definition: StopPoint.cc:43
assert
#define assert(condition)
Definition: Application.hh:86
SimulatorFrontend::programCounter
InstructionAddress programCounter() const
Definition: SimulatorFrontend.cc:1169
StopPoint
Definition: StopPoint.hh:53
Breakpoint::Breakpoint
Breakpoint(SimulatorFrontend &frontend, InstructionAddress address)
Definition: Breakpoint.cc:47
StopPoint::deletedAfterTriggered_
bool deletedAfterTriggered_
Tells if the breakpoint is deleted after it is triggered the next time.
Definition: StopPoint.hh:89
StopPoint::disabledAfterTriggered_
bool disabledAfterTriggered_
Tells if the breakpoint is disabled after it is triggered the next time.
Definition: StopPoint.hh:87
StopPoint::removeCondition
virtual void removeCondition()
Definition: StopPoint.cc:142
StopPoint::ignoreCount_
unsigned int ignoreCount_
The number of times the condition is to be ignored before enabling the breakpoint.
Definition: StopPoint.hh:97
StopPoint::description
virtual std::string description() const =0
Definition: StopPoint.cc:239
StopPoint::setDeletedAfterTriggered
virtual void setDeletedAfterTriggered(bool flag)
Definition: StopPoint.cc:107
StopPoint::setCondition
virtual void setCondition(const ConditionScript &condition)
Definition: StopPoint.cc:131