summaryrefslogtreecommitdiff
path: root/src/common/break_points.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/break_points.h')
-rw-r--r--src/common/break_points.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/common/break_points.h b/src/common/break_points.h
new file mode 100644
index 000000000..dc771ba01
--- /dev/null
+++ b/src/common/break_points.h
@@ -0,0 +1,102 @@
1// Copyright 2013 Dolphin Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#ifndef _DEBUGGER_BREAKPOINTS_H
6#define _DEBUGGER_BREAKPOINTS_H
7
8#include <vector>
9#include <string>
10
11#include "common.h"
12
13class DebugInterface;
14
15struct TBreakPoint
16{
17 u32 iAddress;
18 bool bOn;
19 bool bTemporary;
20};
21
22struct TMemCheck
23{
24 TMemCheck() {
25 numHits = 0;
26 StartAddress = EndAddress = 0;
27 bRange = OnRead = OnWrite = Log = Break = false;
28 }
29 u32 StartAddress;
30 u32 EndAddress;
31
32 bool bRange;
33
34 bool OnRead;
35 bool OnWrite;
36
37 bool Log;
38 bool Break;
39
40 u32 numHits;
41
42 void Action(DebugInterface *dbg_interface, u32 _iValue, u32 addr,
43 bool write, int size, u32 pc);
44};
45
46// Code breakpoints.
47class BreakPoints
48{
49public:
50 typedef std::vector<TBreakPoint> TBreakPoints;
51 typedef std::vector<std::string> TBreakPointsStr;
52
53 const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
54
55 TBreakPointsStr GetStrings() const;
56 void AddFromStrings(const TBreakPointsStr& bps);
57
58 // is address breakpoint
59 bool IsAddressBreakPoint(u32 _iAddress);
60 bool IsTempBreakPoint(u32 _iAddress);
61
62 // Add BreakPoint
63 void Add(u32 em_address, bool temp=false);
64 void Add(const TBreakPoint& bp);
65
66 // Remove Breakpoint
67 void Remove(u32 _iAddress);
68 void Clear();
69
70 void DeleteByAddress(u32 _Address);
71
72private:
73 TBreakPoints m_BreakPoints;
74 u32 m_iBreakOnCount;
75};
76
77
78// Memory breakpoints
79class MemChecks
80{
81public:
82 typedef std::vector<TMemCheck> TMemChecks;
83 typedef std::vector<std::string> TMemChecksStr;
84
85 TMemChecks m_MemChecks;
86
87 const TMemChecks& GetMemChecks() { return m_MemChecks; }
88
89 TMemChecksStr GetStrings() const;
90 void AddFromStrings(const TMemChecksStr& mcs);
91
92 void Add(const TMemCheck& _rMemoryCheck);
93
94 // memory breakpoint
95 TMemCheck *GetMemCheck(u32 address);
96 void Remove(u32 _Address);
97
98 void Clear() { m_MemChecks.clear(); };
99};
100
101#endif
102