@@ -37,6 +37,7 @@ class Debug {
37
37
static bool isInKernel (uint32_t address, bool biosIsKernel = true );
38
38
static inline std::function<const char *()> s_breakpoint_type_names[] = {l_ (" Exec" ), l_ (" Read" ), l_ (" Write" )};
39
39
enum class BreakpointType { Exec, Read, Write };
40
+ enum class BreakpointCondition { Always, Change, Greater, Less, Equal };
40
41
41
42
void checkDMAread (unsigned c, uint32_t address, uint32_t len) {
42
43
std::string cause = fmt::format (" DMA channel {} read" , c);
@@ -66,7 +67,7 @@ class Debug {
66
67
struct InternalTemporaryList {};
67
68
typedef Intrusive::List<Breakpoint, InternalTemporaryList> BreakpointTemporaryListType;
68
69
69
- typedef std::function<bool (const Breakpoint*, uint32_t address, unsigned width, const char * cause)>
70
+ typedef std::function<bool (Breakpoint*, uint32_t address, unsigned width, const char * cause)>
70
71
BreakpointInvoker;
71
72
72
73
class Breakpoint : public BreakpointTreeType ::Node,
@@ -78,6 +79,10 @@ class Debug {
78
79
: m_type(type), m_source(source), m_invoker(invoker), m_base(base), m_label(label) {}
79
80
std::string name () const ;
80
81
BreakpointType type () const { return m_type; }
82
+ BreakpointCondition condition () const { return m_condition; }
83
+ void setCondition (BreakpointCondition condition) { m_condition = condition; }
84
+ uint32_t conditionData () const { return m_conditionData; }
85
+ void setConditionData (uint32_t data) { m_conditionData = data; }
81
86
unsigned width () const { return getHigh () - getLow () + 1 ; }
82
87
uint32_t address () const { return getLow (); }
83
88
bool enabled () const { return m_enabled; }
@@ -95,6 +100,8 @@ class Debug {
95
100
}
96
101
97
102
const BreakpointType m_type;
103
+ BreakpointCondition m_condition = BreakpointCondition::Always;
104
+ uint32_t m_conditionData = 0 ;
98
105
const std::string m_source;
99
106
const BreakpointInvoker m_invoker;
100
107
mutable std::string m_label;
@@ -158,6 +165,10 @@ class Debug {
158
165
if (m_lastBP == bp) m_lastBP = nullptr ;
159
166
delete const_cast <Breakpoint*>(bp);
160
167
}
168
+ void removeAllBreakpoints () {
169
+ m_breakpoints.clear ();
170
+ m_lastBP = nullptr ;
171
+ }
161
172
162
173
private:
163
174
bool triggerBP (Breakpoint* bp, uint32_t address, unsigned width, const char * reason = " " );
0 commit comments