diff options
Diffstat (limited to 'src/common/break_points.cpp')
| -rw-r--r-- | src/common/break_points.cpp | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index e7d0d3e43..3218db314 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp | |||
| @@ -5,30 +5,27 @@ | |||
| 5 | #include "common/break_points.h" | 5 | #include "common/break_points.h" |
| 6 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 7 | 7 | ||
| 8 | #include <sstream> | ||
| 9 | #include <algorithm> | 8 | #include <algorithm> |
| 9 | #include <sstream> | ||
| 10 | 10 | ||
| 11 | bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const | 11 | bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const { |
| 12 | { | ||
| 13 | auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; }; | 12 | auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; }; |
| 14 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); | 13 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); |
| 15 | return it != m_BreakPoints.end(); | 14 | return it != m_BreakPoints.end(); |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 18 | bool BreakPoints::IsTempBreakPoint(u32 iAddress) const | 17 | bool BreakPoints::IsTempBreakPoint(u32 iAddress) const { |
| 19 | { | 18 | auto cond = [&iAddress](const TBreakPoint& bp) { |
| 20 | auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress && bp.bTemporary; }; | 19 | return bp.iAddress == iAddress && bp.bTemporary; |
| 21 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); | 20 | }; |
| 21 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); | ||
| 22 | return it != m_BreakPoints.end(); | 22 | return it != m_BreakPoints.end(); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const | 25 | BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const { |
| 26 | { | ||
| 27 | TBreakPointsStr bps; | 26 | TBreakPointsStr bps; |
| 28 | for (auto breakpoint : m_BreakPoints) | 27 | for (auto breakpoint : m_BreakPoints) { |
| 29 | { | 28 | if (!breakpoint.bTemporary) { |
| 30 | if (!breakpoint.bTemporary) | ||
| 31 | { | ||
| 32 | std::stringstream bp; | 29 | std::stringstream bp; |
| 33 | bp << std::hex << breakpoint.iAddress << " " << (breakpoint.bOn ? "n" : ""); | 30 | bp << std::hex << breakpoint.iAddress << " " << (breakpoint.bOn ? "n" : ""); |
| 34 | bps.push_back(bp.str()); | 31 | bps.push_back(bp.str()); |
| @@ -38,10 +35,8 @@ BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const | |||
| 38 | return bps; | 35 | return bps; |
| 39 | } | 36 | } |
| 40 | 37 | ||
| 41 | void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) | 38 | void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) { |
| 42 | { | 39 | for (auto bps_item : bps) { |
| 43 | for (auto bps_item : bps) | ||
| 44 | { | ||
| 45 | TBreakPoint bp; | 40 | TBreakPoint bp; |
| 46 | std::stringstream bpstr; | 41 | std::stringstream bpstr; |
| 47 | bpstr << std::hex << bps_item; | 42 | bpstr << std::hex << bps_item; |
| @@ -52,18 +47,15 @@ void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) | |||
| 52 | } | 47 | } |
| 53 | } | 48 | } |
| 54 | 49 | ||
| 55 | void BreakPoints::Add(const TBreakPoint& bp) | 50 | void BreakPoints::Add(const TBreakPoint& bp) { |
| 56 | { | 51 | if (!IsAddressBreakPoint(bp.iAddress)) { |
| 57 | if (!IsAddressBreakPoint(bp.iAddress)) | ||
| 58 | { | ||
| 59 | m_BreakPoints.push_back(bp); | 52 | m_BreakPoints.push_back(bp); |
| 60 | //if (jit) | 53 | // if (jit) |
| 61 | // jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4); | 54 | // jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4); |
| 62 | } | 55 | } |
| 63 | } | 56 | } |
| 64 | 57 | ||
| 65 | void BreakPoints::Add(u32 em_address, bool temp) | 58 | void BreakPoints::Add(u32 em_address, bool temp) { |
| 66 | { | ||
| 67 | if (!IsAddressBreakPoint(em_address)) // only add new addresses | 59 | if (!IsAddressBreakPoint(em_address)) // only add new addresses |
| 68 | { | 60 | { |
| 69 | TBreakPoint pt; // breakpoint settings | 61 | TBreakPoint pt; // breakpoint settings |
| @@ -73,22 +65,20 @@ void BreakPoints::Add(u32 em_address, bool temp) | |||
| 73 | 65 | ||
| 74 | m_BreakPoints.push_back(pt); | 66 | m_BreakPoints.push_back(pt); |
| 75 | 67 | ||
| 76 | //if (jit) | 68 | // if (jit) |
| 77 | // jit->GetBlockCache()->InvalidateICache(em_address, 4); | 69 | // jit->GetBlockCache()->InvalidateICache(em_address, 4); |
| 78 | } | 70 | } |
| 79 | } | 71 | } |
| 80 | 72 | ||
| 81 | void BreakPoints::Remove(u32 em_address) | 73 | void BreakPoints::Remove(u32 em_address) { |
| 82 | { | ||
| 83 | auto cond = [&em_address](const TBreakPoint& bp) { return bp.iAddress == em_address; }; | 74 | auto cond = [&em_address](const TBreakPoint& bp) { return bp.iAddress == em_address; }; |
| 84 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); | 75 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); |
| 85 | if (it != m_BreakPoints.end()) | 76 | if (it != m_BreakPoints.end()) |
| 86 | m_BreakPoints.erase(it); | 77 | m_BreakPoints.erase(it); |
| 87 | } | 78 | } |
| 88 | 79 | ||
| 89 | void BreakPoints::Clear() | 80 | void BreakPoints::Clear() { |
| 90 | { | 81 | // if (jit) |
| 91 | //if (jit) | ||
| 92 | //{ | 82 | //{ |
| 93 | // std::for_each(m_BreakPoints.begin(), m_BreakPoints.end(), | 83 | // std::for_each(m_BreakPoints.begin(), m_BreakPoints.end(), |
| 94 | // [](const TBreakPoint& bp) | 84 | // [](const TBreakPoint& bp) |