OpenASIP 2.2
Loading...
Searching...
No Matches
Breakpoint.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2010 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 * @file Breakpoint.cc
26 *
27 * Definition of Breakpoint class.
28 *
29 * @author Atte Oksman 2005 (oksman-no.spam-cs.tut.fi)
30 * @author Pekka Jääskeläinen 2005,2010
31 * @note rating: red
32 */
33
34#include "Breakpoint.hh"
35#include "ConditionScript.hh"
36#include "SimulatorConstants.hh"
37#include "BaseType.hh"
38#include "Application.hh"
39#include "SimulatorFrontend.hh"
40#include "Conversion.hh"
41
42/**
43 * Constructor.
44 *
45 * @param address The address.
46 */
48 SimulatorFrontend& frontend,
49 InstructionAddress address) :
50 StopPoint(), address_(address), frontend_(frontend) {
51}
52
53/**
54 * Destructor.
55 */
58
59/**
60 * Copy method for dynamically bound copies.
61 */
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}
79
80/**
81 * Returns the address the breakpoint is watching.
82 *
83 * @return The address.
84 */
87 return address_;
88}
89
90/**
91 * Sets the address the breakpoint is watching.
92 *
93 * @param newAddress The address.
94 */
95void
97 address_ = newAddress;
98}
99
100/**
101 * Returns true in case this break point is triggered.
102 *
103 * In case the current program counter is the address this break point is
104 * watching, and the general condition is ok, this method returns true.
105 *
106 * @return The status of the breakpoint.
107 */
108bool
112
113/**
114 * Prints the description string of the stop point.
115 *
116 * Each subclass overrides this method to construct a descripting string of
117 * itself.
118 */
119std::string
121 return std::string("at address ") + Conversion::toString(address_) +
122 std::string(" ") + StopPoint::description();
123}
124
#define assert(condition)
UInt32 InstructionAddress
Definition BaseType.hh:175
Breakpoint(SimulatorFrontend &frontend, InstructionAddress address)
Definition Breakpoint.cc:47
virtual void setAddress(InstructionAddress newAddress)
Definition Breakpoint.cc:96
virtual StopPoint * copy() const
Definition Breakpoint.cc:63
virtual bool isTriggered() const
SimulatorFrontend & frontend_
The simulator frontend which is used to fetch the current PC.
Definition Breakpoint.hh:69
virtual InstructionAddress address() const
Definition Breakpoint.cc:86
virtual std::string description() const
virtual ~Breakpoint()
Definition Breakpoint.cc:56
InstructionAddress address_
The address of the breakpoint. A breakpoint is fired when PC equals this address.
Definition Breakpoint.hh:67
virtual ConditionScript * copy() const
static std::string toString(const T &source)
InstructionAddress programCounter() const
bool enabled_
Tells whether the breakpoint is enabled or disabled.
Definition StopPoint.hh:84
virtual void removeCondition()
Definition StopPoint.cc:142
virtual std::string description() const =0
Definition StopPoint.cc:239
bool conditional_
Tells whether the breakpoint is conditional or not.
Definition StopPoint.hh:91
virtual void setDeletedAfterTriggered(bool flag)
Definition StopPoint.cc:107
virtual void setEnabled(bool flag)
Definition StopPoint.cc:63
bool disabledAfterTriggered_
Tells if the breakpoint is disabled after it is triggered the next time.
Definition StopPoint.hh:87
bool deletedAfterTriggered_
Tells if the breakpoint is deleted after it is triggered the next time.
Definition StopPoint.hh:89
virtual void setCondition(const ConditionScript &condition)
Definition StopPoint.cc:131
ConditionScript * condition_
The condition which is used to determine whether the breakpoint should be fired or not.
Definition StopPoint.hh:94
unsigned int ignoreCount_
The number of times the condition is to be ignored before enabling the breakpoint.
Definition StopPoint.hh:97
virtual void setDisabledAfterTriggered(bool flag)
Definition StopPoint.cc:85
virtual void setIgnoreCount(unsigned int count)
Definition StopPoint.cc:182